simple test for nufft not working

5 visualizaciones (últimos 30 días)
Pieter van Wyk
Pieter van Wyk el 27 de Mzo. de 2023
Editada: Pieter van Wyk el 27 de Mzo. de 2023
I have a very simple test code for using the nufft function:
%% define signal
t = [-1.0/(2*pi),1.0/(2*pi)];
X = [1.0,1.0];
%% compute the NFFT
f_k = -10:10;
Y_k = nufft(X,t,f_k);
Accroding to the equation given in the documentation the result of this test should be , but the result is just a real constant across . How do I need to modify my program to deliver the correct result, or is this a bug?

Respuesta aceptada

Paul
Paul el 27 de Mzo. de 2023
Editada: Paul el 27 de Mzo. de 2023
Hi Pieter,
I don't think that expression for Y(k) is correct. We can check symbolically
%% define signal
t = sym([-1.0,1.0]);
X = [1.0/(2*sym(pi)),1.0/(2*sym(pi))];
%% compute the NFFT
%f_k = sym(-10:10);
%Y_k = nufft(X,t,f_k)
syms f_k
% expression of Y(k) from the doc page for nufft
Yk = sum(X.*exp(-1j*2*sym(pi)*t*f_k))
Yk = 
Yk = simplify(Yk)
Yk = 
Subbing back in the values of f_k from the original problem
cos(2*pi*(-10:10))/pi
ans = 1×21
0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183
which matches the result from nufft.
nufft(double(X),double(t),-10:10)
ans = 1×21
0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183 0.3183

Más respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by