C Library Functions  - fourie (3)

NAME

fourie(3f) - [M_datapac:ANALYSIS] perform a Fourier analysis of a data set

CONTENTS

Synopsis
Description
Input Arguments
Output
Examples
Author
Maintainer
License
References

SYNOPSIS

SUBROUTINE FOURIE(X,N)

       REAL(kind=wp),intent(in) :: X(:)
       INTEGER                  :: N

DESCRIPTION

FOURIE(3f) performs a Fourier analysis of the data in the input vector X. The analysis consists of the following--
1. computing (and printing) (for each of the harmonic frequencies 1/n, 2/n, 3/n, ..., 1/2) the corresponding fourier coefficients, the amplitude, the phase, the contribution to the total variance, and the relative contribution to the total variance.
2. plotting out a fourier line spectrum = the periodogram = the plot of relative contribution to total variance (at each fourier frequency) versus the fourier frequency.

In order that the results of the Fourier analysis be valid and properly interpreted, the input data in X should be equi-spaced in time (or whatever variable corresponds to time).

The horizontal axis of the spectra produced by fourie(3f) is frequency. This frequency is measured in units of cycles per ’data point’ or, more precisely, in cycles per unit time where ’unit time’ is defined as the elapsed time between adjacent observations.

The range of the frequency axis is 0.0 to 0.5.

Fourier analysis differs from spectral analysis (as, for example, produced by the datapac TIMESE(3f) subroutine) in that a Fourier analysis does no smoothing on the spectral estimates whereas a spectral analysis does smooth the spectral estimates. The net result is that the spectral estimates obtained from a Fourier analysis are almost always more variable than those obtained in a spectral analysis.

The practical conclusion is that when the data analyst has a choice of whether to perform a Fourier analysis or a spectral analysis, the spectral analysis should almost always be preferred.

the maximum number of Fourier frequencies for which the Fourier coefficients is computed (and listed) is N/2 where N is the sample size (length of the data record in the vector X). This rule is overridden (for listing purposes only) in large data sets and is replaced by the rule that the maximum number of lags listed = 800 (which corresponds to an 8-page listing of Fourier coefficients. If more pages are desired, change the value of the variable MAXPAG within this subroutine from 8 to whatever is desired.

If the input observations in X are considered to have been collected 1 second apart in time, then the frequency axis of the resulting spectra would be in units of Hertz (= cycles per second).

The frequency of 0.0 corresponds to a cycle in the data of infinite (= 1/(0.0)) length or period. the frequency of 0.5 corresponds to a cycle in the data of length = 1/(0.5) = 2 data points.

Any equi-spaced fourier analysis is intrinsically limited to detecting frequencies no larger than 0.5 cycles per data point; this corresponds to the fact that the smallest detectable cycle in the data is 2 data points per cycle.

INPUT ARGUMENTS

X The vector of (unsorted) observations.
N The integer number of observations in the vector X. The maximum allowable value of N for this subroutine is 15000. The sample size N must be greater than or equal to 3.

OUTPUT

2 to 10 pages (depending on the input sample size) of automatic printout--

1. a listing of the amplitude, phase, contribution to the total variance, and relative contribution to the total variance for each of the fourier frequencies (1/n, 2/n, 3/n, ..., 1/2). this listing may take as little as 1 page or as many as n/100 pages (the exact number depending on the input sample size n). this listing is terminated after at most 8 computer pages. if more pages are desired, change the value of the variable maxpag within this subroutine from 8 to whatever desired.
2. a plot of the relative contribution to the total variance versus frequency.

EXAMPLES

Sample program:

   program demo_fourie
   use M_datapac, only : fourie
   implicit none
   ! call fourie(x,y)
   end program demo_fourie

Results:

AUTHOR

The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.

MAINTAINER

John Urban, 2022.05.31

LICENSE

CC0-1.0

REFERENCES

o Jenkins and Watts, especially page 290.


Nemo Release 3.1 fourie (3) July 22, 2023
Generated by manServer 1.08 from 53beb23e-6773-4f6e-9211-8aa92eef2f37 using man macros.