Easy to use Power Spectrum

ezfft(T,U) plots the power spectrum of the signal U(T) , where T is a 
'time' and U is a real signal (T can be considered as a space 
coordinate as well). If T is a scalar, then it is interpreted as the 
'sampling time' of the signal U.  If T is a vector, then it is 
interpreted as the 'time' itself. In this latter case, T must be 
equally spaced (as obtained by LINSPACE for instance), and it must 
have the same length as U. If T is not specified, then a 'sampling 
time' of unity (1 second for instance) is taken. Windowing 
(appodization) can be applied to reduce border effects (see below). 
[W,E] = ezfft(T,U) returns the power spectrum E(W), where E is the 
energy density and W the pulsation 'omega'.  W is *NOT* the frequency: 
the frequency is W/(2*pi). If T is considered as a space coordinate, 
W is a wave number (usually noted K = 2*PI/LAMBDA, where LAMBDA is a 
ezfft(..., 'Property1', 'Property2', ...) specifies the properties: 
 'hann'    applies a Hann appodization window to the data (reduces 
 'disp'    displays the spectrum (by default if no output argument) 
 'freq'    the frequency f is displayed instead of the pulsation omega 
           (this applies for the display only: the output argument 
           remains the pulsation omega, not the frequency f). 
 'space'   the time series is considered as a space series. This simply 
           renames the label 'omega' by 'k' (wave number) in the plot, 
           but has no influence on the computation itself. 
 'handle'  returns a handle H instead of [W,E] - it works only if the 
           properties 'disp' is also specified. The handle H is useful 
           to change the line properties (color, thickness) of the 
           plot (see the example below). 
The length of the vectors W and E is N/2, where N is the length of U 
(this is because U is assumed to be a real signal.) If N is odd, the 
last point of U and T are ignored. If U is not real, only its real part 
is considered. 
    W(1) is always 0.  E(1) is the energy density of the average of U 
      (when plotted in log coordinates, the first point is W(2), E(2)). 
    W(2) is the increment of pulsation, Delta W, given by 2*PI/Tmax 
    W(end), the highest measurable pulsation, is PI/DT, where DT is the 
       sampling time (Nyquist theorem). 
Parseval Theorem (Energy conservation): 
For every signal U, the 'energy' computed in the time domain and in the 
frequency domain are equal, 
    MEAN(U.^2) == SUM(E)*W(2) 
where W(2) is the pulsation increment Delta W. 
Note that, depending on the situation considered, the physical 'energy' 
is usually defined as 0.5*MEAN(U.^2). Energy conservation only applies 
if no appodization of the signal (windowing) is used. Otherwise, some 
energy is lost in  the appodization, so the spectral energy is lower 
than the actual one. 
  simple display of a power spectrum 
   t = linspace(0,400,2000); 
   u = 0.2 + 0.7*sin(2*pi*t/47) + cos(2*pi*t/11); 
  how to change the color of the plot 
   h = ezfft(t,u,'disp','handle'); 
  how to use the output of ezfft 
   [w,e] = ezfft(t,u,'hann'); 
See Also

Help file generated by makehtmldoc 1.22