use absolute time in dft and fft
This commit is contained in:
parent
ca8c5eeee4
commit
36c933c208
@ -20,8 +20,6 @@ if numel(t) ~= numel(val)
|
||||
error 'numel(t) ~= numel(val)'
|
||||
end
|
||||
|
||||
% convert absolute time into relative time
|
||||
t = t - t(1);
|
||||
dt = t(2)-t(1);
|
||||
|
||||
f_val = zeros(1,numel(freq));
|
||||
|
@ -11,3 +11,6 @@ val = fft( val, NFFT)*dt;
|
||||
f = 1/(2*dt) * linspace(0,1,NFFT/2+1);
|
||||
|
||||
val = 2*val(1:NFFT/2+1); % single-sided spectrum
|
||||
|
||||
%correct phase for time-shifted signals
|
||||
val = val .* exp(-1j*2*pi*f * t(1));
|
||||
|
@ -53,7 +53,4 @@ for n=1:numel(filenames)
|
||||
UI.FD{n}.f = freq;
|
||||
UI.FD{n}.val = DFT_time2freq( t, val, freq );
|
||||
end
|
||||
|
||||
%correct phase error for time-shifted signals
|
||||
UI.FD{n}.val = UI.FD{n}.val .* exp(-1j*2*pi*UI.FD{n}.f * t(1));
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user