You are on page 1of 3

Lab4A Continuous-time signal x(t) is shown in Fig. With the help of MATLAB find following signalsa.

x(t)u(1-t)
b. x(t)[u(t)-u(t-1)]
c. x(t)(t-3/2)

ProgramA. To generate given signal


function a=x(t)
a1=t+1;
a2=1;
a3=2;
a=a1.*(-1<=t & t<=0)+a2.*(0<t & t<=1)+a3.*(1<t & t<=2);

B. To generate unit step signalfunction a=u(t)


a1=1;
a=a1.*(0<=t );
C. To generate unit impulse signalfunction a=i(t)
a=1.*(t==0);

D. To calculate given signalclear all


t=-10:0.01:10;
y0=x(t);
y1=u(1-t);
q=[u( t ) - u(t - 1)];
p=i(t-3/2);
y2=y0*diag(y1);
y3=y0*diag(p);
y4=y0*diag(q);
subplot(2,2,1),plot(t,y0,'r')
axis([-3 3 -3 3])
subplot(2,2,2),plot(t,y2,'g')
axis([-3 3 -3 3])
subplot(2,2,3),plot(t,y3,'y')
axis([-3 3 -3 3])
subplot(2,2,4),plot(t,y4,'r')
axis([-3 3 -3 3])

OUTPUT-

You might also like