FFT, Inadequate Frequency precision

10 views (last 30 days)
I must write a code that gives me the harmonic content of voltage and current signals. The fundamental frequency of both the signals is at 10.273MHz and the sampling frequency is Fs=5GHz. I am implementing fft() to get the data I need. The thing is that the time vector is a 1x10 000 array. This translates in a frequency step of 500kHz (or 0.5MHz). So I couldn't ever get the correct frequency component of 10.273MHz (the array has values of 10.250MHz and 10.30MHz). As a result of course, when I reconstruct my original signal, which I need to do to verify my results the signals aren't quite the same. I tried specifying the points of fft example:(fft(X,n,dim) where n the number of points) but the result deviates from the correct value by a little both in frequency and amplitude. Is there any way I could get the exact correct answer or do I need a bigger dataset for this (let's say a signal of 50000 datapoints)? By the way I have of course already made a simple signal to process instead of real data, but still I can't seem to make it work as I want it to.
  3 Comments
Bill G.
Bill G. on 7 Dec 2021
Edited: Bill G. on 7 Dec 2021
Computing the IFFT of the fourier coefficients and ploting them together with the original dataset. Ideally I would want to compute the IFFT of the harmonic and the fundamental frequencies only.
Paul
Paul on 7 Dec 2021
This operation
%yhat = ifft(fft(y))
should result in yhat and y being very, very close to each other. I'm not sure of the degree to which the difference yhat - y is influenced by the number of elements in y. But this issue, to my understanding, has nothing to do with whether or not one of the frequency centers falls right on 10.273 MHz, so perhaps I don't fully understand the question.
F0 = 10.273e6;
Fs = 5e9;
Ts = 1/Fs;
N = 10000;
y = sin(2*pi*F0*(0:(N-1)*Ts) + randn(1,N));
yhat = ifft(fft(y));
max(abs(y-yhat))
ans = 1.1102e-15

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Dec 2021
You need a longer signal to get that resolution. Twice as many points would get you to 10.275 and you would need more than that to resolve the last digit

More Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!