[4] | 1 | <html><head><title>ezfft (Ezyfit Toolbox)</title> |
---|
| 2 | <!-- Help file for ezfft.m generated by makehtmldoc 1.22, 02-Jul-2012 09:32:07 --> |
---|
| 3 | <!-- makehtmldoc (F. Moisy, 2005-2006), see http://www.fast.u-psud.fr/~moisy/ml/ --> |
---|
| 4 | |
---|
| 5 | <link rel=stylesheet href="docstyle1.css" type="text/css"> |
---|
| 6 | </head> |
---|
| 7 | <body bgcolor=#ffffff> |
---|
| 8 | <table width="100%" border=0 cellpadding=0 cellspacing=0><tr><td valign=baseline bgcolor="#e7ebf7"><b>EzyFit Function Reference</b></td><td valign=baseline bgcolor="#e7ebf7" align=right><a href="evalfit.html"><b><< Prev</b></a> | <a href="ezfit.html"><b>Next >></b></a> </td></tr></table> |
---|
| 9 | <font size=+3 color="#990000">ezfft</font><br> |
---|
| 10 | Easy to use Power Spectrum<br> |
---|
| 11 | <br> |
---|
| 12 | |
---|
| 13 | <font size=+1 color="#990000"><b>Description</b></font> |
---|
| 14 | <code><pre> |
---|
| 15 | <b>ezfft</b>(T,U) plots the power spectrum of the signal U(T) , where T is a |
---|
| 16 | 'time' and U is a real signal (T can be considered as a space |
---|
| 17 | coordinate as well). If T is a scalar, then it is interpreted as the |
---|
| 18 | 'sampling time' of the signal U. If T is a vector, then it is |
---|
| 19 | interpreted as the 'time' itself. In this latter case, T must be |
---|
| 20 | equally spaced (as obtained by LINSPACE for instance), and it must |
---|
| 21 | have the same length as U. If T is not specified, then a 'sampling |
---|
| 22 | time' of unity (1 second for instance) is taken. Windowing |
---|
| 23 | (appodization) can be applied to reduce border effects (see below). |
---|
| 24 | |
---|
| 25 | [W,E] = <b>ezfft</b>(T,U) returns the power spectrum E(W), where E is the |
---|
| 26 | energy density and W the pulsation 'omega'. W is *NOT* the frequency: |
---|
| 27 | the frequency is W/(2*pi). If T is considered as a space coordinate, |
---|
| 28 | W is a wave number (usually noted K = 2*PI/LAMBDA, where LAMBDA is a |
---|
| 29 | wavelength). |
---|
| 30 | |
---|
| 31 | <b>ezfft</b>(..., 'Property1', 'Property2', ...) specifies the properties: |
---|
| 32 | 'hann' applies a Hann appodization window to the data (reduces |
---|
| 33 | aliasing). |
---|
| 34 | 'disp' displays the spectrum (by default if no output argument) |
---|
| 35 | 'freq' the frequency f is displayed instead of the pulsation omega |
---|
| 36 | (this applies for the display only: the output argument |
---|
| 37 | remains the pulsation omega, not the frequency f). |
---|
| 38 | 'space' the time series is considered as a space series. This simply |
---|
| 39 | renames the label 'omega' by 'k' (wave number) in the plot, |
---|
| 40 | but has no influence on the computation itself. |
---|
| 41 | 'handle' returns a handle H instead of [W,E] - it works only if the |
---|
| 42 | properties 'disp' is also specified. The handle H is useful |
---|
| 43 | to change the line properties (color, thickness) of the |
---|
| 44 | plot (see the example below). |
---|
| 45 | |
---|
| 46 | The length of the vectors W and E is N/2, where N is the length of U |
---|
| 47 | (this is because U is assumed to be a real signal.) If N is odd, the |
---|
| 48 | last point of U and T are ignored. If U is not real, only its real part |
---|
| 49 | is considered. |
---|
| 50 | |
---|
| 51 | W(1) is always 0. E(1) is the energy density of the average of U |
---|
| 52 | (when plotted in log coordinates, the first point is W(2), E(2)). |
---|
| 53 | W(2) is the increment of pulsation, Delta W, given by 2*PI/Tmax |
---|
| 54 | W(end), the highest measurable pulsation, is PI/DT, where DT is the |
---|
| 55 | sampling time (Nyquist theorem). |
---|
| 56 | |
---|
| 57 | Parseval Theorem (Energy conservation): |
---|
| 58 | For every signal U, the 'energy' computed in the time domain and in the |
---|
| 59 | frequency domain are equal, |
---|
| 60 | MEAN(U.^2) == SUM(E)*W(2) |
---|
| 61 | where W(2) is the pulsation increment Delta W. |
---|
| 62 | Note that, depending on the situation considered, the physical 'energy' |
---|
| 63 | is usually defined as 0.5*MEAN(U.^2). Energy conservation only applies |
---|
| 64 | if no appodization of the signal (windowing) is used. Otherwise, some |
---|
| 65 | energy is lost in the appodization, so the spectral energy is lower |
---|
| 66 | than the actual one. |
---|
| 67 | |
---|
| 68 | As for FFT, the execution time depends on the length of the signal. |
---|
| 69 | It is fastest for powers of two. |
---|
| 70 | |
---|
| 71 | </pre> |
---|
| 72 | <font size=+1 color="#990000"><b>Example</b></font> |
---|
| 73 | <pre> |
---|
| 74 | simple display of a power spectrum |
---|
| 75 | t = linspace(0,400,2000); |
---|
| 76 | u = 0.2 + 0.7*sin(2*pi*t/47) + cos(2*pi*t/11); |
---|
| 77 | <b>ezfft</b>(t,u); |
---|
| 78 | |
---|
| 79 | </pre> |
---|
| 80 | <font size=+1 color="#990000"><b>Example</b></font> |
---|
| 81 | <pre> |
---|
| 82 | how to change the color of the plot |
---|
| 83 | h = <b>ezfft</b>(t,u,'disp','handle'); |
---|
| 84 | set(h,'Color','red'); |
---|
| 85 | |
---|
| 86 | </pre> |
---|
| 87 | <font size=+1 color="#990000"><b>Example</b></font> |
---|
| 88 | <pre> |
---|
| 89 | how to use the output of <b>ezfft</b> |
---|
| 90 | [w,e] = <b>ezfft</b>(t,u,'hann'); |
---|
| 91 | loglog(w,e,'b*'); |
---|
| 92 | |
---|
| 93 | </pre> |
---|
| 94 | <font size=+1 color="#990000"><b>See Also</b></font> |
---|
| 95 | <pre> |
---|
| 96 | FFT |
---|
| 97 | |
---|
| 98 | Published output in the Help browser |
---|
| 99 | showdemo <b>ezfft</b> |
---|
| 100 | </pre></code> |
---|
| 101 | |
---|
| 102 | <br> |
---|
| 103 | <table width="100%" border=0 cellspacing=0 bgcolor="#e7ebf7"><tr><td> <a href="evalfit.html"><b>Previous: evalfit</b></a></td><td align=right><a href="ezfit.html"><b>Next: ezfit</b></a> </td></tr></table><br> |
---|
| 104 | 2005-2012 <a href="ezyfit.html">EzyFit Toolbox 2.41</a><br> |
---|
| 105 | <br> |
---|
| 106 | </body></html> |
---|