# MagicPlot Manual

Plotting and nonlinear fitting software

fft

# Differences

This shows you the differences between two versions of the page.

 fft [Thu Jun 10 09:22:21 2010]Alexander fft [Thu Jan 14 17:14:11 2021]Alexander Both sides previous revision Previous revision Thu Jan 14 17:14:11 2021 Alexander Sun Nov 8 12:21:24 2015 external editMon May 12 18:27:15 2014 Alexander Mon May 12 18:05:47 2014 Alexander Tue Jun 4 00:49:15 2013 Alexander Mon Jun 3 15:42:02 2013 Alexander Thu May 30 12:07:37 2013 Alexander Mon Feb 28 12:43:08 2011 Alexander Mon Feb 28 12:40:50 2011 Alexander Fri Nov 5 12:32:12 2010 Gray Sun Oct 31 22:25:18 2010 Gray Tue Oct 26 10:59:32 2010 Alexander Tue Oct 26 10:57:03 2010 Alexander Tue Oct 26 10:05:33 2010 Alexander Thu Oct 7 13:17:06 2010 Alexander Tue Jul 6 10:34:36 2010 Alexander Tue Jul 6 10:20:14 2010 Alexander Sun Jun 27 15:38:14 2010 Gray Sun Jun 27 14:48:46 2010 Gray Sun Jun 27 14:21:38 2010 Gray Sat Jun 26 21:46:59 2010 Alexander Sat Jun 26 20:50:05 2010 Alexander Mon Jun 14 19:01:28 2010 Alexander Mon Jun 14 19:01:02 2010 Alexander Mon Jun 14 18:45:47 2010 Alexander Mon Jun 14 18:32:14 2010 Alexander Thu Jun 10 09:22:21 2010 Alexander Thu May 20 19:57:08 2010 Alexander Wed May 12 18:53:06 2010 Alexander Wed May 12 18:51:01 2010 Alexander Wed May 5 10:04:06 2010 Alexander Wed May 5 10:02:13 2010 Alexander Wed May 5 10:01:41 2010 Alexander Wed May 5 09:58:52 2010 Alexander Tue May 4 18:39:46 2010 Alexander Fri Apr 30 09:41:56 2010 Alexander Fri Apr 30 09:41:10 2010 Alexander Wed Apr 28 13:36:54 2010 Alexander Wed Apr 28 10:49:24 2010 Alexander Mon Apr 26 13:03:27 2010 Alexander Mon Apr 26 11:27:16 2010 Alexander Mon Apr 26 09:21:14 2010 Alexander Mon Apr 26 09:09:27 2010 Alexander Mon Apr 26 02:15:00 2010 Alexander Mon Apr 26 01:46:13 2010 Alexander Mon Apr 26 01:45:28 2010 Alexander Mon Apr 26 01:40:59 2010 Alexander Mon Apr 26 01:25:13 2010 Alexander Mon Apr 26 00:58:15 2010 Alexander created Next revision Previous revision Thu Jan 14 17:14:11 2021 Alexander Sun Nov 8 12:21:24 2015 external editMon May 12 18:27:15 2014 Alexander Mon May 12 18:05:47 2014 Alexander Tue Jun 4 00:49:15 2013 Alexander Mon Jun 3 15:42:02 2013 Alexander Thu May 30 12:07:37 2013 Alexander Mon Feb 28 12:43:08 2011 Alexander Mon Feb 28 12:40:50 2011 Alexander Fri Nov 5 12:32:12 2010 Gray Sun Oct 31 22:25:18 2010 Gray Tue Oct 26 10:59:32 2010 Alexander Tue Oct 26 10:57:03 2010 Alexander Tue Oct 26 10:05:33 2010 Alexander Thu Oct 7 13:17:06 2010 Alexander Tue Jul 6 10:34:36 2010 Alexander Tue Jul 6 10:20:14 2010 Alexander Sun Jun 27 15:38:14 2010 Gray Sun Jun 27 14:48:46 2010 Gray Sun Jun 27 14:21:38 2010 Gray Sat Jun 26 21:46:59 2010 Alexander Sat Jun 26 20:50:05 2010 Alexander Mon Jun 14 19:01:28 2010 Alexander Mon Jun 14 19:01:02 2010 Alexander Mon Jun 14 18:45:47 2010 Alexander Mon Jun 14 18:32:14 2010 Alexander Thu Jun 10 09:22:21 2010 Alexander Thu May 20 19:57:08 2010 Alexander Wed May 12 18:53:06 2010 Alexander Wed May 12 18:51:01 2010 Alexander Wed May 5 10:04:06 2010 Alexander Wed May 5 10:02:13 2010 Alexander Wed May 5 10:01:41 2010 Alexander Wed May 5 09:58:52 2010 Alexander Tue May 4 18:39:46 2010 Alexander Fri Apr 30 09:41:56 2010 Alexander Fri Apr 30 09:41:10 2010 Alexander Wed Apr 28 13:36:54 2010 Alexander Wed Apr 28 10:49:24 2010 Alexander Mon Apr 26 13:03:27 2010 Alexander Mon Apr 26 11:27:16 2010 Alexander Mon Apr 26 09:21:14 2010 Alexander Mon Apr 26 09:09:27 2010 Alexander Mon Apr 26 02:15:00 2010 Alexander Mon Apr 26 01:46:13 2010 Alexander Mon Apr 26 01:45:28 2010 Alexander Mon Apr 26 01:40:59 2010 Alexander Mon Apr 26 01:25:13 2010 Alexander Mon Apr 26 00:58:15 2010 Alexander created Line 2: Line 2: Open Table or Figure or Plot with initial data and use ''Processing -> Fast Fourier Transform'' menu item to perform [[wp>FFT]]. Open Table or Figure or Plot with initial data and use ''Processing -> Fast Fourier Transform'' menu item to perform [[wp>FFT]]. - MagicPlot uses the algorithm of FFT that does not require the number of points //N// to be the integer power of 2. Though the evaluation time of the FFT algorithm is much less if //N// is the integer power of 2. MagicPlot uses [[http://www.netlib.org/fftpack|jfftpack]] library (a Java version of fftpack). + Fast Fourier transform algorithm computes discrete Fourier transform exactly and is used to considerably speed up the calculations.\\ Note that FFT is not an approximate method of calculation. - {{:fft1.png|FFT of table columns dialog}} {{:fft2.png|FFT of curves dialog}} + {{:fft.png?nolink|}} + + ===== Parameters ===== + + ^ Sampling Interval  | Sampling interval of original data Δ//t// is used to compute the data in resulting sampling column. MagicPlot calculates sampling interval as a difference between second and first values in ''Sampling'' column. You can set sampling interval manually in ''Sampling Interval'' field. \\ Note that using of discrete Fourier transform implies that the samples in your original data are equally spaced in time/frequency, i.e. the sampling interval is constant. If the sampling interval is varying or real and/or imaginary data contains empty cells in the middle, the result of discrete Fourier transform will be incorrect.  | + ^ Real, \\ Imaginary  | Columns with real and imaginary components of data. \\ If your data is purely real, select '''' imaginary item  | + ^ Forward / \\ Inverse  | Transform direction (here ''Inverse'' also equals to ''Backward'') | + ^ 1/N in forward transform  | Divide forward transform result by number of points //N// (see formulas table). If your original data is real, you may want to additionally multiply the result by 2 to get the true amplitudes of real signal. Also referred as ''Normalize'' in some other applications.  | + ^ Center zero frequency  | If selected, after forward Fourier transform the two parts of spectrum will be rearranged so that the lower frequency components are in the center; the opposite rearrangement of spectrum will be done before inverse transform if any. Also referred as ''Shift FFT'' in some other applications. | + + ===== Algorithm ===== + + MagicPlot uses the algorithm of FFT that does not necessarily require the number of points //N// to be an integer power of 2, though in such a case evaluation is faster. MagicPlot uses [[http://www.netlib.org/fftpack|jfftpack]] library (a Java version of fftpack). - ===== Formulas ===== ==== Discrete Fourier Transform Formulas ==== ==== Discrete Fourier Transform Formulas ==== - MagicPlot uses 'electrical engineering' convention to set the sign of the exponential phase factor of FFT as follows from the table below. ((Most scientific applications uses the same sign conventions. But note, that the sign of exponential phase factor in Numerical Receipts in C, 2nd edition, p. 503 is the opposite)) + By default MagicPlot uses 'electrical engineering' convention to set the sign of the exponential phase factor of FFT: forward transform is computed using factor ''-1''. Most scientific applications use factor ''-1'' in forward transform as MagicPlot does by default. But note that the sign of exponential phase factor in Numerical Receipts in C, 2nd edition, p. 503 and in MATLAB package in forward transform is ''+1''. - ^  Normalize Forward \\ Transform  ^  Forward Transform \\ (Signal->Spectrum)  ^  Inverse Transform \\ (Spectrum->Signal)  ^ + ^  Factor −1 (Default)  ^^^ - ^  Unchecked  |  C_n = sum{k=1}{N}{c_k e^{−2 pi i k n {/} N}}  |  c_n = 1/N sum{k=1}{N}{C_k e^{2 pi i k n {/} N}}  | + ^  1/N in forward \\ transform  ^  Forward Transform \\ (Signal->Spectrum)  ^  Inverse Transform \\ (Spectrum->Signal)  ^ - ^  Checked  |  C_n = 1/N sum{k=1}{N}{c_k e^{−2 pi i k n {/} N}}  |  c_n = sum{k=1}{N}{C_k e^{2 pi i k n {/} N}}  | + ^  Checked \\ (Default)  |  C_n = 1/N sum{k=1}{N}{c_k e^{−2 pi i k n {/} N}}  |  c_n = sum{k=1}{N}{C_k e^{2 pi i k n {/} N}}  | - Here //cn// are complex signal components and //Cn// are complex spectrum components, //n// = 1...//N//. + ^  Unchecked  |  C_n = sum{k=1}{N}{c_k e^{−2 pi i k n {/} N}}  |  c_n = 1/N sum{k=1}{N}{C_k e^{2 pi i k n {/} N}}  | - The only difference is in the sign of exponential phase factor and 1///N// multiplier. + \\ - Note: If you expect to get the original data when doing a inverse FFT of forward FFT set the ''Normalize Forward Transform'' and ''Center Zero Frequency'' check boxes identically for forward and inverse transforms. + ^  Factor +1 (Scientific)  ^^^ + ^  1/N in forward \\ transform  ^  Forward Transform \\ (Signal->Spectrum)  ^  Inverse Transform \\ (Spectrum->Signal)  ^ + ^  Checked \\ (Default)  |  C_n = 1/N sum{k=1}{N}{c_k e^{2 pi i k n {/} N}}  |  c_n = sum{k=1}{N}{C_k e^{−2 pi i k n {/} N}}  | + ^  Unchecked  |  C_n = sum{k=1}{N}{c_k e^{2 pi i k n {/} N}}  |  c_n = 1/N sum{k=1}{N}{C_k e^{−2 pi i k n {/} N}}  | + + + Here //cn// are complex signal components and //Cn// are complex spectrum components, //n// = 1...//N//. The only difference is in the sign of exponential phase factor and 1///N// multiplier. + + Note: if you expect to get the original data when doing an inverse FFT of forward FFT, set the ''1/N in Forward Transform'', ''Center Zero Frequency'' and ''Factor'' options the same for forward and inverse transforms. ==== Amplitude and Phase Columns Formulas ==== ==== Amplitude and Phase Columns Formulas ==== - Amplitude_n = sqrt{{Re_n}^2 + {Im_n}^2},~~ Phase_n = atan2(Im_n,~ Re_n) + A_n = sqrt{{Re_n}^2 + {Im_n}^2},~~ phi_n = atan2(Im_n,~ Re_n) - Because of using [[wp>atan2]] function the phase is unwrapped and is in range (//−π//, //π//]. + Because of using ''[[wp>atan2]]'' function the phase is unwrapped and is in range (//−π//, //π//]. The result of ''atan2(y, x)'' is similar to calculating the arc tangent of ''y/x'', except that the signs of both arguments are used to determine the quadrant of the result. ==== Sampling Column Formulas ==== ==== Sampling Column Formulas ==== - ^  Center Zero \\ Frequency  ^  Sampling Column Values  ^ + Sampling column contains frequency samples if forward transform is performed and time samples in case of inverse transform. - ^  Unchecked  |  0,~ 1/{N Delta t},~ 2/{N Delta t},~ ... ~{N−1}/{N Delta t}  | + ^  Center zero \\ frequency  ^  Formula  ^  Sampling Column Values  ^ - ^  Checked  |  {−{N{/}2}/{N Delta t}},~ ...~ 0,~ ... ~{N{/}2−1}/{N Delta t}  | + ^  Unchecked  |  f_n={n−1}/{N Delta t}  |  0,~ 1/{N Delta t},~ 2/{N Delta t},~ ... ~{N−1}/{N Delta t}  | - Here Δ//t// is given sampling interval of initial data. + ^  Checked  |  f_n={n−1−{N{/}2}}/{N Delta t}  |  {−{N{/}2}/{N Delta t}},~ ...~ 0,~ ... ~{N{/}2−1}/{N Delta t}  | + Here Δ//t// is given sampling interval of initial data (time for FFT and frequency for IFFT), //n// = 1...//N//. ==== Missing Values in the Original Data ==== ==== Missing Values in the Original Data ==== - Fourier transform implies that the original samples are uniformly distributed in time (for forward transform) of frequency (for inverse transform). + Fourier transform implies that the original samples are uniformly distributed in time (for forward transform) or frequency (for inverse transform). * Missing values in the middle or in beginning of original data columns are treated as zeros, the result of Fourier transform may be incorrect. * Missing values in the middle or in beginning of original data columns are treated as zeros, the result of Fourier transform may be incorrect. Line 37: Line 57: * Missing values in the end of the column are ignored. * Missing values in the end of the column are ignored. - ===== Parameters ===== + ===== See Also ===== - ^ Sampling Interval  | Sampling interval of original data Δ//t// is used to compute the data in resulting sampling column. If ''Get from''  box is set, MagicPlot will calculate sampling interval as difference between two beginning values from given column. You can set sampling interval manually by checking ''Set manually'' box. \\ Note that using of discrete Fourier transform implies that the samples in your original data are equally spaced in time/frequency, i.e. the sampling interval is constant. If the sampling interval is varying or real and/or imaginary data contains empty cells in the middle, the result of discrete Fourier transform will be incorrect.  | + * [[processing]] - ^ Real, \\ Imaginary  | Columns with real and imaginary components of data. \\ If your data is only real, select ''''  imaginary item  | + - ^ Forward / \\ Inverse  | Transform direction (here Inverse equals to Backward) | + - ^ Normalize forward transform  | Divide forward transform result by number of points //N// (see table). If your original data is real, you may want to additionally multiply the result by 2 to get the true amplitudes of real signal  | + - ^ Center zero frequency  | If selected, after forward Fourier transform the two parts of spectrum will be rearranged so that the lower frequency components are in the center; the opposite rearrangement of spectrum will be done before inverse transform if any.  | +