FFT, Inadequate Frequency precision

9 ビュー (過去 30 日間)
Bill G.
Bill G. 2021 年 12 月 6 日
コメント済み: Paul 2021 年 12 月 7 日
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 件のコメント
Bill G.
Bill G. 2021 年 12 月 7 日
編集済み: Bill G. 2021 年 12 月 7 日
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 2021 年 12 月 7 日
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

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 6 日
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
  1 件のコメント
Bill G.
Bill G. 2021 年 12 月 6 日
I see, thanks a lot for your immediate response!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by