Pages

Saturday, June 7, 2014

time shifting and scaling of signal


% time shifting and scaling of signal
clc;
clear all;
close all;

limit=15;
step=0.01;
T=5;
t=-limit:step:limit;

 x=t.*[t>=0 & t<=T];
 subplot(421)
 plot (t,x);
 grid on;
 xlabel('x(t)');

 a=-1;
 t0=0;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(422)
 plot (t,x);
 grid on;
 xlabel('x(-t)');

 a=1;
 t0=5;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(423)
 plot (t,x);
 grid on;
 xlabel('x(t+5)');

 a=1;
 t0=-5;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(424)
 plot (t,x);
 grid on;
 xlabel('x(t-5)');

 a=2;
 t0=0;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(425)
 plot (t,x);
 grid on;
 xlabel('x(2t)');

 a=1/2;
 t0=0;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(426)
 plot (t,x);
 grid on;
 xlabel('x(t/2)');

 a=2;
 t0=5;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(427)
 plot (t,x);
 grid on;
 xlabel('x(2t+5)');

 a=-2;
 t0=5;
 t1=a*t+t0;
 x=t1.*[t1>=0 & t1<=T];
 subplot(428)
 plot (t,x);
 grid on;
 xlabel('x(-2t+5)');