Documentation 
Compute nonparametric estimate of spectrum using periodogram method
The Magnitude FFT block computes a nonparametric estimate of the spectrum using the periodogram method.
When the Output parameter is set to Magnitude squared, the block output for an MbyN input u is equivalent to
y = abs(fft(u,nfft)).^2 % M ≤ nfft
When the Output parameter is set to Magnitude, the block output for an input u is equivalent to
y = abs(fft(u,nfft)) % M ≤ nfft
When M > N_{fft}, the block wraps the input to N_{fft} before computing the FFT using one of the above equations:
y(:,k)=datawrap(u(:,k),nfft) % 1 ≤ k ≤ N
When M > N_{fft}, the block can also truncate the input:
y(:,k)=abs(fft(u,nfft)) % 1 ≤ k ≤ N
The block treats an MbyN matrix input as M sequential time samples from N independent channels. The block computes a separate estimate for each of the N independent channels and generates an N_{fft}byN matrix output. Each column of the output matrix contains the estimate of the corresponding input column's power spectral density at N_{fft} equally spaced frequency points in the range [0,F_{s}), where F_{s} represents the signal's sample frequency. The block always outputs sample–based data.
The Magnitude FFT block supports real and complex floatingpoint inputs. The block also supports real fixedpoint inputs in both Magnitude and Magnitude squared modes, and complex fixedpoint inputs in the Magnitude squared mode.
The following diagram shows the data types used within the Magnitude FFT subsystem block for fixedpoint signals.
The settings for the fixedpoint parameters of the FFT block in the diagram above are as follows:
Sine table — Same word length as input
Integer rounding mode — Floor
Saturate on integer overflow — unchecked
Product output — Inherit via internal rule
Accumulator — Inherit via internal rule
Output — Inherit via internal rule
The settings for the fixedpoint parameters of the Magnitude Squared block in the diagram above are as follows:
Integer rounding mode — Floor
Saturate on integer overflow — checked
Output — Inherit via internal rule
The dspsacompdspsacomp example compares the periodogram method with several other spectral estimation methods.
Specify whether the block computes the magnitude FFT or magnitudesquared FFT of the input.
Set this parameter to FFTW [1], [2] to support an arbitrary length input signal. The block restricts generated code with FFTW implementation to MATLAB^{®} host computers.
Set this parameter to Radix2 for bitreversed processing, fixed or floatingpoint data, or for portable Ccode generation using the Simulink^{®} Coder™. The first dimension M, of the input matrix must be a power of two. To work with other input sizes, use the Pad block to pad or truncate these dimensions to powers of two, or if possible choose the FFTW algorithm.
Set this parameter to Auto to let the block choose the FFT implementation. For nonpoweroftwo transform lengths, the block restricts generated code to MATLAB host computers.
Select to use the input frame size as the number of data points, on which to perform the FFT. When you select this check box, this number must be a power of two. When you do not select this check box, the FFT length parameter specifies the number of data points.
Enter the number of data points on which to perform the FFT, N_{fft}. When N_{fft} is larger than the input frame size, each frame is zeropadded as needed. When N_{fft} is smaller than the input frame size, each frame is wrapped as needed. This parameter is enabled when you clear the Inherit FFT length from input dimensions check box.
When you set the FFT implementation parameter to Radix2, this value must be a power of two.
Choose to wrap or truncate the input, depending on the FFT length. If this parameter is checked, modulolength data wrapping occurs before the FFT operation, given FFT length is shorter than the input length. If this property is unchecked, truncation of the input data to the FFT length occurs before the FFT operation. The default is checked.
Oppenheim, A. V. and R. W. Schafer. DiscreteTime Signal Processing. Englewood Cliffs, NJ: PrenticeHall, 1989.
Orfanidis, S. J. Introduction to Signal Processing. Englewood Cliffs, NJ: PrenticeHall, 1995.
Proakis, J. and D. Manolakis. Digital Signal Processing. 3rd ed. Englewood Cliffs, NJ: PrenticeHall, 1996.
[1] FFTW (http://www.fftw.org)
[2] Frigo, M. and S. G. Johnson, "FFTW: An Adaptive Software Architecture for the FFT,"Proceedings of the International Conference on Acoustics, Speech, and Signal Processing, Vol. 3, 1998, pp. 13811384.
Port  Supported Data Types 

Input 

Output 

Burg Method  DSP System Toolbox 
ShortTime FFT  DSP System Toolbox 
Spectrum Analyzer  DSP System Toolbox 
YuleWalker Method  DSP System Toolbox 
pwelch  Signal Processing Toolbox 
See Spectral Analysis for related information.