MATLAB Fouriertransform with nunequidistant values
2 次查看(过去 30 天)
显示 更早的评论
Hello there,
I am currently working on a frequencyanalysis. For this, I have a signal with a non-static signaling frequency. In other words, I have one vector 'y' with measurement (pixel with maximum intensity) and one vector 'time' with times inbetween measurements. Each value in the measurements vector corresponds to one measurements.
The sampling frequency is about 5 Hz, which is why I wrote this fft()-code:
load('y');
load('times')
Fs = 5;
Ts = 1/Fs;
nfft = length(y);
dt = 0:Ts:Ts*nfft-Ts;
ff = fft(y);
ff(1) = [];
nfft = length(ff);
ffabs = abs(ff(1:floor(nfft/2)+1));
freq = (1:length(ffabs))*Fs/length(y);
subplot(2,1,1);
plot(dt,y);
subplot(2,1,2)
plot(freq,ffabs);
This does the basic fouriertransform but does not incorperate the actual times for each measurement. The Vector times is built up of the times in secondy after the beginning of the measurement ([0.886769 1.125059 1.301065 1.497016 1.69091 1.885543 2.061231 ...]).
Does anyone have an idea how to incorperate these times into the code. Help is verymuch appreciated!!
Cheers
0 个评论
回答(3 个)
dpb
2018-7-1
The simplest route is to interpolate to a fixed sample rate and apply the FFT to that series.
0 个评论
Star Strider
2018-7-1
I would use the Signal Processing Toolbox resample (link) function to interpolate it to a regularly-sampled time base. There is an option to use a time vector created by the linspace function. Then use fft to take the Fourier transform. (If I remember correctly, there are File Exchange contributions that can deal with non-uniformly sampled data. Using reshape is likely easier.) The resample function uses an anti-aliasing filter to avoid the resampling problems encountered using interp1 alone, so use resample if you are going to be doing further signal processing on your data.
0 个评论
Vilnis Liepins
2018-7-2
编辑:Vilnis Liepins
2018-7-2
You can apply File Exchange program 'nedft' available on https://se.mathworks.com/matlabcentral/fileexchange/11020-extended-dft.
load('y');
load('times')
Fs = 5;
Ts = 1/Fs;
nfft = length(y);
fr=[-ceil((nfft-1)/2):floor((nfft-1)/2)]/(nfft*Ts); % Uniform set of frequencies in [-1/2Ts,1/2Ts[
ff=fftshift(nedft(y,times,fr)); Calculate DFT on fr and fftshift
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!