MATLAB Answers

ong

How to do FT Time shift and Time scaling properties

Asked by ong
on 28 Mar 2013

Currently i am trying use matlab to do the FT properties -time shift and time scaling, can someone help me in the implementation? i would like to prove that Timeshift: F[x(t-τ) ]= e^(-jwτ) F[x(t)]

Time scaling: F[x(at)]=1/(|a|) X(w/a)

Thanks.

  0 Comments

Products

No products are associated with this question.

4 Answers

Answer by Wayne King
on 28 Mar 2013
Edited by Wayne King
on 28 Mar 2013
 Accepted answer
 t=0:0.001:0.1-0.001;
 Fs = 1e3;
 freq1 = 100;
 x1=cos(2*pi*freq1*t);
 Delay=2;
 yp = fft(x1);
 yp = yp(1:length(x1)/2+1);
 f = 0:Fs/length(x1):500;
 yp = yp.*exp(-1i*2*pi*f*Delay*(1/Fs));
 yp = [yp conj(fliplr(yp(2:end-1)))];
 y = ifft(yp,'symmetric');
 plot(t(1:100),x1(1:100),'b');
 hold on;
 plot(t(1:100),y(1:100),'r');

  1 Comment

ong
on 29 Mar 2013

Hi Wayne, thanks for your help. I am able to observe the shift but i couldn't get the same plot result when comparing:

 D=2;
Fs=1000;
freq1=100;
t=0:0.001:1-0.001;
    x=cos(2*pi*freq1*(t-D));
    y1 = fft(x);

and

 x1=cos(2*pi*freq1*t);
 Delay=2;
 yp = fft(x1);
 yp = yp(1:length(x1)/2+1);
 f = 0:Fs/length(x1):500;
 yp = yp.*exp(-1i*2*pi*f*Delay*(1/Fs));

any reason why? Thanks.


Answer by Wayne King
on 28 Mar 2013
Edited by Wayne King
on 28 Mar 2013
 n = 0:159;
 x = cos(pi/4*n);
 y = cos(pi/4*(n-2));
 xdft = fft(x);
 ydft = fft(y);
 xdft(21)
 ydft(21)

Note that 80+i0 has become 0-80i due to the predicted phase shift of e^{-i\pi/2}

Obviously, the only way to properly "prove" that theorem is mathematically.

The scaling one you have to be careful with in discrete-time because scaling doesn't work the same with a discrete variable as it does with continuous time.

  1 Comment

ong
on 28 Mar 2013

Is there anyway that i can do it in this form:

t=0:0.001:1

x1=cos(2*pi*freq1*t)

Delay=2

yp = fft(x1);

yp = yp.*exp(-j*2*pi*t*Delay);


Answer by Wayne King
on 29 Mar 2013
Edited by Wayne King
on 29 Mar 2013

They agree if you get the delay right. You're not delaying the signal by 2. You're trying to delay the signal by two samples, but that has to take into account the sampling interval, so you're actually delaying the signal by 0.002 seconds.

 t = 0:0.001:1-0.001;
 freq1 = 100;
 Fs = 1000;
 x1=cos(2*pi*freq1*t);
 Delay=2;
 yp = fft(x1);
 yp = yp(1:length(x1)/2+1);
 f = 0:Fs/length(x1):500;
 yp = yp.*exp(-1i*2*pi*f*Delay*(1/Fs));
 yp = [yp conj(fliplr(yp(2:end-1)))];
 yrec = ifft(yp,'symmetric');

Compare with

D=2;
Fs=1000;
freq1=100;
t=0:0.001:1-0.001;
x=cos(2*pi*freq1*(t-(D*(1/Fs))));
y1 = fft(x);
y1T = ifft(y1,'symmetric');
max(abs(y1T-yrec))

You can see the above are identical. Thank you for accepting my answer if I have helped you.

  1 Comment

ong
on 29 Mar 2013

Hi there, Thanks for the clear explanation. However, i have one more issue, does it work the same way if i m having my fft display in the angle instead of abs?

I tried having it plot in the phase domain but there is some differ in the result.


Answer by ong
on 3 Apr 2013

To update on this question, Wayne King provided the explanation and the steps provided are accurate. However there is one problem, instead of ifft the abs function, it was to display in the phase domain, here, the phase for the time shift properties and the function:cos(2*pi*freq1*(t-(D*(1/Fs) doesnt match.

There are error to the phase shift, anyone can help please?

Thanks.

  0 Comments


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today