Fourier transform of shifted signals (FFT)

조회 수: 27(최근 30일)
Konstantinos
Konstantinos 2016년 8월 7일
답변: Prasobhkumar P. P. 2020년 3월 4일
I am trying to verify the following identity in Matlab for the Fourier transform of a shifted signal: F{x(t-t0)}={exp(-j*2*pi*F*t0)}. Say that my initial signal starts at position 1 of the vector. Basically, I start by adding some K_left_max zeros at the beggining and K_right_max at the end of the signal which represent the maximum shifting duration I will probably need to the left and right respectively, in terms of samples. Then, I take the fft of this signal. Based on the previous property, I now have to multiply this transform by {exp(+j*2*pi*F*K_left_max*Ts)} since I have to cancel the delay I have after adding the K_left_max zeros to the initial signal. Then I take this fft and I multiply it by the shifting I have, say K samples (K>0 => delay, K<0 => advancing). Finally, I compare this fft with the fft of the signal delayed in time domain.
Here is the code:
%signal length
N=10;
%maximum shifting lengths
K_left_max=10;
K_right_max=10;
%non zero values of the signal
x0=rand(1,N);
%initial signal shifted to the right by K_left_max*Ts
x=[zeros(1,K_left_max) x0 zeros(1,K_right_max)];
%sampling period
Ts=0.25;
%sampling frequency
Fs=1/Ts;
%fourier
X=Ts*fftshift(fft(x));
%frequency axis
F=[-Fs/2:Fs/(K_left_max+N+K_right_max):Fs/2-Fs/(K_left_max+N+K_right_max)];
%correct right shifting
X=X.*exp(1j*2*pi*F*K_left_max*Ts);
An example of delay:
%delayed signal (to the right)
K=1;
left=zeros(1,K_left_max+K);
y=[left x0 zeros(1, length(x)-length(left)-length(x0))];
%fourier of delayed signal
Y=Ts*fftshift(fft(y));
%correct right shifting
Y=Y.*exp(1j*2*pi*F*K_left_max*Ts);
%fourier of delayed signal
Yother=X.*exp(-1j*2*pi*F*K*Ts);
An example of advancing:
%delayed signal (to the left)
K=-5;
left=zeros(1,K_left_max+K);
y=[left x0 zeros(1, length(x)-length(left)-length(x0))];
%fourier of delayed signal
Y=Ts*fftshift(fft(y));
%correct right shifting
Y=Y.*exp(1j*2*pi*F*K_left_max*Ts);
%fourier of delayed signal
Yother=X.*exp(-1j*2*pi*F*K*Ts);
Please note that the following relations should hold: K <= K_right_max for right shifting and abs(K) <= K_left_max for left shifting.
This method seems to work fine (Yother has the same value as Y) but I have two questions:
  • 1. K_left_max+N+K_right_max i.e. the signal length need to a multiple of Fs for this to work. Why?
  • 2. Is my thought about shifting to the left correct? Basically, if I had to do only delays, I would only zero pad the end of the signal which would be less to worry about.

답변(1개)

Prasobhkumar P. P.
Prasobhkumar P. P. 2020년 3월 4일
Why do you multiply by Ts? X=Ts*fftshift(fft(x));
As per MATLAB's fft definition, it take cares of it automatically.
Please clarify, if I miss something here

Community Treasure Hunt

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

Start Hunting!

Translated by