Is it possible to perform FFT on a non-power of 2 length signal in Simulink using DSP System Toolbox?
6 views (last 30 days)
Show older comments
In my signal processing application I need an FFT on non-power of 2 length signal. I noticed that the FFT block in the Signal Processing Blockset (or DSP System Toolbox) and the FFT in Embedded MATLAB only support powers of two. The FFT command in MATLAB works for any length. I would like to know if there is any FFT block that can handle non-power of two length sequences.
Accepted Answer
MathWorks Support Team
on 2 Nov 2011
This enhancement has been incorporated in Release 2011b (R2011b). For previous product releases, read below for any possible workarounds:
The ability to perform FFT on a non-power of 2 length signal using a Simulink block is not available in DSP System Toolbox (or Signal Processing Blockset).
To work around this issue, you can use an Embedded MATLAB function block and the eml.extrinsic function to call MATLAB’s FFT function. This will enable you to perform FFT computation on non-power of 2 length signals in Simulink. Below is an example of this procedure for performing an FFT on some signal x.
eml.extrinsic('fft');
y = complex(zeros(size(x),class(x)));
y = fft(x);
The first line tells the Embedded MATLAB compiler to call the FFT function from base MATLAB. The initialization of y just tells the Embedded MATLAB compiler how to dissect the mxArray that MATLAB will return so that it can be stored in an ordinary C array.
However, please note that this approach is not compatible with code generation using Real-Time Workshop or Simulink HDL Coder.
0 Comments
More Answers (0)
See Also
Categories
Find more on Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!