How does nufft function work in matlab?
I am trying to understand how to use nufft function. For this, I started by comparing the results of the fft and nufft transforms of a Gaussian to see if they yield the same result. I find that for a spacing in t space that is not unity, they yield different results. The exmple in MATLAB for nufft also has unit spacing between the t coordinates. Does nufft function not work for non-unit spacing? This would be a problem for me since the next step is to get the fourier transform of a gaussian with different spacings in the t space, i.e, dt varies for each element.
Thank you.
tmax = 12;
n = 2^11;
tau = 1; % Width of the gaussian pulse
dt = 2*tmax/n;
t = (-tmax:dt:tmax-dt);
fmax = 1/(2*dt);
df = 2*fmax/n;
f = -fmax:df:fmax-df;
Pulse = exp(-(t/tau).^2);
%Pulse = sin(t/tau);
fftPulse = ifftshift(fft(Pulse));
subplot(2,1,1)
plot(t,Pulse)
subplot(2,1,2)
plot(f,abs(fftPulse)); hold on;
nufftPulse = ifftshift(nufft(Pulse,t));
plot(f,abs(nufftPulse))I am trying to understand how to use nufft function. For this, I started by comparing the results of the fft and nufft transforms of a Gaussian to see if they yield the same result. I find that for a spacing in t space that is not unity, they yield different results. The exmple in MATLAB for nufft also has unit spacing between the t coordinates. Does nufft function not work for non-unit spacing? This would be a problem for me since the next step is to get the fourier transform of a gaussian with different spacings in the t space, i.e, dt varies for each element.
Thank you.
tmax = 12;
n = 2^11;
tau = 1; % Width of the gaussian pulse
dt = 2*tmax/n;
t = (-tmax:dt:tmax-dt);
fmax = 1/(2*dt);
df = 2*fmax/n;
f = -fmax:df:fmax-df;
Pulse = exp(-(t/tau).^2);
%Pulse = sin(t/tau);
fftPulse = ifftshift(fft(Pulse));
subplot(2,1,1)
plot(t,Pulse)
subplot(2,1,2)
plot(f,abs(fftPulse)); hold on;
nufftPulse = ifftshift(nufft(Pulse,t));
plot(f,abs(nufftPulse)) I am trying to understand how to use nufft function. For this, I started by comparing the results of the fft and nufft transforms of a Gaussian to see if they yield the same result. I find that for a spacing in t space that is not unity, they yield different results. The exmple in MATLAB for nufft also has unit spacing between the t coordinates. Does nufft function not work for non-unit spacing? This would be a problem for me since the next step is to get the fourier transform of a gaussian with different spacings in the t space, i.e, dt varies for each element.
Thank you.
tmax = 12;
n = 2^11;
tau = 1; % Width of the gaussian pulse
dt = 2*tmax/n;
t = (-tmax:dt:tmax-dt);
fmax = 1/(2*dt);
df = 2*fmax/n;
f = -fmax:df:fmax-df;
Pulse = exp(-(t/tau).^2);
%Pulse = sin(t/tau);
fftPulse = ifftshift(fft(Pulse));
subplot(2,1,1)
plot(t,Pulse)
subplot(2,1,2)
plot(f,abs(fftPulse)); hold on;
nufftPulse = ifftshift(nufft(Pulse,t));
plot(f,abs(nufftPulse)) nufft, nonuniform fourier trasform MATLAB Answers — New Questions