I am trying to perform the fast fourrier transform to non uniformly sampled data . The output is in the following image enter image description here

It was obtained using the following code in MATLAB

%% x is the sampled signal
%% t is the sampling instances
t_new = linspace(t(1),t(end),L); 

% Performing interpolation to obtain a uniformly sampled signal
x_new_cubic = interp1(t,x,t_new,'cubic'); 
x_new_pchip =interp1(t,x,t_new,'pchip');
x_new_spline = interp1(t,x,t_new,'spline');

NFFT = 2^nextpow2(L);
X = fft(x_new_cubic,NFFT)/L;


w =  hamming(L,'periodic');
x_win = w.*x_new_cubic(1:L)';
X_win = fft(x_win,NFFT)/L;

title('Hamming Window')

It seems that I can't trust such result, but I am not sure too. Can any one give me some advice?

  • $\begingroup$ Your code is unreadable in its current form, but I can tell you that the fft() function assumes that its input is evenly spaced. I don't know what you'll get if it's not, but it won't be the DFT. $\endgroup$ – AnonSubmitter85 Feb 4 '14 at 18:14
  • $\begingroup$ @AnonSubmitter85 I did an interpolation first, to obtain a uniformly sampled data $\endgroup$ – user2536125 Feb 4 '14 at 18:25
  • $\begingroup$ You need to use a resampling method that includes filtering. You can't just interpolate with splines and and the like and expect the spectrum to be as it should. Also, you'll get more visibility from the right people if you add the signal-processing tag. The dsp stackexchange site is another option for help on things like this. $\endgroup$ – AnonSubmitter85 Feb 5 '14 at 0:28
  • $\begingroup$ Migrating by OP request. $\endgroup$ – Willie Wong Feb 5 '14 at 11:49
  • $\begingroup$ Actually, interpolation should be useful. I don't know what the question actually is. $\endgroup$ – user7358 Feb 5 '14 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.