Azzera filtri
Azzera filtri

FFT HDL Optimized block output is different from FFT block output

3 visualizzazioni (ultimi 30 giorni)
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!

Risposte (3)

Alireza
Alireza il 20 Lug 2016
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
  1 Commento
Milruwan
Milruwan il 21 Lug 2016
Modificato: Milruwan il 21 Lug 2016
Thanks for the help Alireza, I got the point. But without observing the fft of fft through the spectrum analyzer, I get the fft of the signal and do the ifft to observe the output in the time domain. Still the output is distorted. What is the reason?
simulink model is in the zip file.

Accedi per commentare.


Bharath Venkataraman
Bharath Venkataraman il 21 Lug 2016
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.
  1 Commento
Milruwan
Milruwan il 4 Ago 2016
Hi Bharath Venkataraman, Thanks for the answer. After connecting the valid input to the valid out model is working fine.

Accedi per commentare.


Alireza
Alireza il 20 Lug 2016
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.
  1 Commento
Milruwan
Milruwan il 20 Lug 2016
Hi Alireza, Thanks for the answer. I set the "Sample per frame" property in Sine Wave block to 32, But still the output is wrong. Spectrum is not a 100 Hz fft output.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by