How to difine the frequency range with the function 'nufft'?

21 ビュー (過去 30 日間)
xinsheng cheng
xinsheng cheng 2021 年 6 月 22 日
回答済み: NGR MNFD 2022 年 7 月 5 日
The example is
t = [0:300 500.5:700.5];
S = 2*sin(0.1*pi*t) + sin(0.02*pi*t);
X = S + rand(size(t));
Y = nufft(X,t);
n = length(t);
f = (0:n-1)/n;
plot(f,abs(Y))
The frequency range here is [0,1],
My question is, for a noun-uniform (unknown) signal, How to calculate the frequency range? It is still 'f = (0:n-1)/n'?
  1 件のコメント
NGR MNFD
NGR MNFD 2022 年 7 月 4 日
hi dear xinsheng
I have the same question as you.Are you find your answer exactly?Thank you for your guidance

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

回答 (4 件)

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 6 月 22 日
To understand what you get out of a non-uniform Fourier-transform I find it educational to calculate the dftmtx and then purge the columns that you don't have data-samples from. In your case with 2 periods with 1 and 2 Hz sampling this would be rather simple:
t_full = 0:700.5;
t = [0:300 500.5:700.5];
t_full = 0:.5:700.5;
M_FFT0 = dftmtx(numel(t_full));
M_FFT = M_FFT0;
[~,~,idxMissing] = setxor(t,t_full);
M_FFT(:,idxMissing) = [];
S0 = 2*sin(0.1*pi*t_full) + sin(0.02*pi*t_full);
S = 2*sin(0.1*pi*t) + sin(0.02*pi*t);
fS = M_FFT*S(:);
fS0 = M_FFT0*S0(:);
plot(fftshift(abs(fS0)))
hold on
plot(fftshift(abs(fS)))
This should allow you to play with the theoretical frequency-resolution of the nufft, for different sample gaps.
HTH
  1 件のコメント
xinsheng cheng
xinsheng cheng 2021 年 6 月 23 日
Thanks for your comments.
The frequency-resolution t is the same as t_full in your case ? Is that you want to express?
However, I still don't understand it well. What does it mean?
I want to know how the frequency range is obtained? In your case, is the horizontal axis the number of samples? How to convert it to the frequency?
Thanks for your suggestions again.

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


xinsheng cheng
xinsheng cheng 2021 年 6 月 26 日
Finnaly, I used the matlab function 'blomp' to get the PSD spectrum.

may miao
may miao 2022 年 2 月 17 日
You can read the following code and compare the fft and nufft results.
close all
clear
fs=1000;
ts=2;
N=fs*ts;
%fft for uniform data
t=(0:N-1)/fs;
x2= 2*sin(2*200*pi*t) + sin(2*117*pi*t);
Y2 = fft(x2);
figure
plot((0:N-1)/ts,abs(Y2)/N*2);
%nufft
n=([0:100 110:150 185:197 220:500 512:558 570:700 705:735 752:800 802:879 885:N]);
x= 2*sin(2*200*pi*n/fs) + sin(2*117*pi*n/fs);
Y = nufft(x,n,(0:N-1)/N);
hold on;plot((0:N-1)/ts,abs(Y)/N*2)

NGR MNFD
NGR MNFD 2022 年 7 月 5 日
hi dear xinsheng
I have the same question as you.Are you find your answer exactly?Thank you for your guidance

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by