Programmer Guide/Command Reference/EVAL/fft: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 31: | Line 31: | ||
;<var>aref</var>: reference amplitude if the log. spectrum (''ytype''=4) is requested (default=1) | ;<var>aref</var>: reference amplitude if the log. spectrum (''ytype''=4) is requested (default=1) | ||
;Result: A matrix ''y'' with [[../ncol|ncol(''x'')]] columns, where each column ''y''[*,j] contains the spectrum of the column (channel) ''x''[*,j]. The type and the length of the spectra is selected by the argument ''ytype''. | ;Result: A matrix ''y'' with [[../ncol|ncol(''x'')]] columns, where each column ''y''[*,j] contains the spectrum of the column (channel) ''x''[*,j]. The type and the length of the spectra is selected by the argument ''ytype''. | ||
::{class="einrahmen" | ::{|class="einrahmen" | ||
!''ytype'' !! content of y[*,j] !! nrow(y) | !''ytype'' !! content of y[*,j] !! nrow(y) | ||
|- | |- | ||
|'''0''' || the complex spectrum in cartesian format<BR>{ re<sub>0</sub>, im<sub>0</sub>, re<sub>1</sub>, im<sub>1</sub>, ... } || L+2 | |'''0''' || the complex spectrum in cartesian format<BR>{ re<sub>0</sub>, im<sub>0</sub>, re<sub>1</sub>, im<sub>1</sub>, ... } || L+2 | ||
|- | |- | ||
|'''1''' || the complex spectrum in polar format<BR>{ amp<sub>0</sub>, phase<sub>0</sub>, amp<sub>1</sub>, phase<sub>1</sub>, ... } || L+2 | |||
|- | |||
|'''2''' || the amplitude spectrum<pre> | |||
{ amp<sub>0</sub>, amp<sub>1</sub>, ... }</pre> | |||
| L+1 | |||
|- | |||
|'''3''' || the power spectrum<BR>{ amp<sub>0</sub><sup>2</sub>, amp<sub>1</sub><sub>2</sub>, ... } || L+1 | |||
|- | |||
|'''4''' || the logarithmic amplitude spectrum<BR>{ lev<sub>0</sub>, lev<sub>1</sub>, ... }<BR>with: lev<sub>i</sub> = || L+1 | |||
|} | |} | ||
Revision as of 11:22, 12 April 2011
Compute the discrete fourier transform of a real signal using the fft or the dft algorithm.
- Usage 1
fft(n)
- n
- desired signal window length (scalar)
- Result 1
- The next (nearest) possible signal window length.
- Usage 2
fft(x)
- x
- signal vector or matrix; if x is a matrix a spectrum of each column is computed
- Result 2
- A matrix y with ncol(x) columns and L+2 rows, where each column y[*,j] contains the complex spectrum of the column (channel) x[*,j]. The transformation length L is set to npow2(nrow(x)).
- Usage 3
fft(x, n {, ytype, poffset, prange, aref})
- x
- signal vector or matrix; if x is a matrix a spectrum of each column is computed
- n
- desired length of analysis window;
- If
n < nrow(x)
, the analysis window length L is set to nrow(x), otherwise L is set to n. - If the analysis window length L is a power of 2 (L=2^M), the fft algorithm is used, otherwise the dft is used.
- If L is greater than nrow(x), zero padding is applied to the signal.
- If
- ytype
- select the type and format of the computed spectrum (see Result 3)
- poffset
- offset in samples to the signal begin or the selected zero phase position (default=0)
poffset='0 -> phase[i] = atan2(im[i], re[i])
otherwise -> phase[i] = (atan2(im[i], re[i]) - 2*pi*i/L * poffset) % (2 * pi)
- prange
- selects the range of phase values
prange='0 -> 0 <= phase[i] < 2*pi
otherwise -> -pi <= phase[i] < pi
- aref
- reference amplitude if the log. spectrum (ytype=4) is requested (default=1)
- Result
- A matrix y with ncol(x) columns, where each column y[*,j] contains the spectrum of the column (channel) x[*,j]. The type and the length of the spectra is selected by the argument ytype.
ytype content of y[*,j] nrow(y) 0 the complex spectrum in cartesian format
{ re0, im0, re1, im1, ... }L+2 1 the complex spectrum in polar format
{ amp0, phase0, amp1, phase1, ... }L+2 2 the amplitude spectrum { amp<sub>0</sub>, amp<sub>1</sub>, ... }
L+1 3 the power spectrum
{ amp02, amp12, ... }L+1 4 the logarithmic amplitude spectrum
{ lev0, lev1, ... }
with: levi =L+1