Inconsistencies in FFT IP Core and Matlab FFT Output
I'm attempting to simulate a fixed point variable streaming FFT IP core in Matlab, and compare its output to the output of the built-in Matlab fft. The core produces transforms that are similar to the output from Matlab, but the peaks for test signals tend to show up at different frequencies, and the error varies depending on the input frequency. Is this to be expected, or have I missed something?
The following is my Matlab script:
%set up input parameters
DATA_WIDTH = 1024;
SAMP_RATE = 100;
INVERSE = 0;
%input parameters
AMPLITUDE = 127;
FREQ = 30;
%define time
time = (0:1/SAMP_RATE:(DATA_WIDTH/SAMP_RATE));
%create input signal
data_in = (AMPLITUDE*sin(2*pi*FREQ*time));
%take the fft of the input with MATLAB's function
matlabfft = fft(data_in);
%use the IP core to take the FFT. Undo the digit reverse
alterafft = fft_ii_0_example_design_model(data_in,DATA_WIDTH,INVERSE);
alterafft = alterafft(digit_reverse(0:(1024-1), log2(1024)) + 1);
Thank you!
Hi,
Sorry for the delay. I have been performing some tests in Matlab on this. For your information, based on my understanding, Matlab FFT seems to be working with Natural data type only. I have generated a FFT instance with configuration similar to yours but set the Input Order = Natural instead of Digit Reverse. This is to further isolate the part of undoing digit reverse.
As I simulated the Matlab model using your fft_test.m, it seems like I am able to get similar peak frequency between Matlab FFT and CV FFT. I have sent the simulation zip and the screenshot to you through the Forum email for your reference.
Note that I am using CV FFT in Q17.0Std and Matlab R2015a since I only have these available in my PC.
Please let me know if there is any concern. Thank you.
Best regards,
Chee Pin