How to get a frequency vector in NUFFT MATLAB CODE?

3 ビュー (過去 30 日間)
NGR MNFD
NGR MNFD 2022 年 7 月 4 日
回答済み: Vinay 2024 年 9 月 23 日
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'?
I don not know how to get frequency vector for my data,that which is not in the normalized frequency range, In fact, it should be in the real frequency range (due to the non-uniform sampling rate).what the matlab code that i should use?
thanks so much .
  1 件のコメント
NGR MNFD
NGR MNFD 2022 年 7 月 5 日
Does anyone have an idea on my problem?

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

回答 (1 件)

Vinay
Vinay 2024 年 9 月 23 日
The ‘nufft’ uses the default frequencies with the form f(i) = (i-1)/n for a signal length of n. The nonuniform discrete Fourier transform treats the nonuniform sample points t and frequencies f as if they have a sampling period of 1 s and a sampling frequency of 1 Hz for the equivalent uniformly sampled data.
We can define the frequency vector by calculating average sampling frequency by taking the mean of the sampling intervals and calculating the normalized frequency vector as shown below
% calculate the sampling intervals
dt = diff(t);
% Estimate the average sampling frequency
fs_avg = 1 / mean(dt);
% Calculate the frequency vector
n = length(t);
f = (0:n-1) * (fs_avg / n);
Kindly refer to the below documentation of “nufft” for more details:
I hope this helps!

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by