FFT HDL Optimized block output is different from FFT block output
1 次查看(过去 30 天)
显示 更早的评论
Hi... Everyone, I need to implement a n point fft on a Fpga. So, for the testing purpose I have created a simulation model to test the output of the n point fft and ifft model. The output from the n-point FFT HDL Optimized block is different from FFT block output. Whats going wrong with this simulation? How do I need to modify the model?
Simulink model
Configuration is as follows.
1. Created a sine wave with following parameters.
2. Parameters of FFT HDL Optimized block
3. Parameters of IFFT HDL Optimized block
4. Parameters of FFT block
5. Figure of FFT HDL Optimized block output
6. Figure of IFFT HDL Optimized block output
7. Figure of FFT block output
Above (Figure of FFT block output) is the desired output. But fft/ifft hdl optimized outputs gives a wrong result. Please help me on this problem.
Thank You!
0 个评论
回答(3 个)
Alireza
2016-7-20
Hi Milruwan, The spectrum analyzer takes the FFT of the input signal, which means that what you are looking at is the FFT of an FFT. The error between FFT (set the FFT implementation to radix 2 inside the FFT block) and HDL Optimized FFT is of order e-14, or e-15 if you are concerned about the mismatch between these two blocks. To see the spectrum you need to save the data in a "To Workspace" and plot the result for 32 samples. Here is what I modified in your model to plot and also calculate the error.
Inside the subsystem there is a Spectrum analyzer and To Workspace block.
The error will be: simout.signals.values(:,1,1) - simout1.signals.values(:,1,1)
and you can plot stem(abs(simout.signals.values(:,1,1))) The result will be
Bharath Venkataraman
2016-7-21
To connect the fft to the ifft, you also need to connect the valid out port of the fft to the valid in port of the ifft. Likewise, to observe the output of the ifft, use the valid out port to control an enabled subsystem that contains the time scope.
Alireza
2016-7-20
In your model, you send one sample at a time to FFT and FFT HDL optimized. FFT zero pads the input data to create a frame the same size as FFT length (in this case 32). However in FFT HDL Optimized, zero padding doesn't happen. Therefore the result is different. If you set the "Sample per frame" property in Sine Wave block to 32, you will see the same result.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!