Lab1 Continuous
Lab1 Continuous
t=-5:0.1:5;
x=t;
x(find(t<0))=0;
subplot(3,3,5);
plot(t,x);
axis([-5,5,-3,3]);
grid on;
title('Ramp signal');
Q.N.3 plot the function x(t)=2e^at for a=0,a=-1 and a=1.compare the signals
obtained for a=0,a=-1 and a=+1.
t=-5:0.1:5;
a=0;
y=2*exp(a*t);
subplot(3,3,7);
plot(t,y);
grid on;
title('plot of x(t)=2e^a^t for a=0');
a=-1;
y=2*exp(a*t);
subplot(3,3,8);
plot(t,y);
grid on;
title('plot of x(t)=2e^a^t for a=-1');
a=1;
y=exp(a*t);
subplot(3,3,9);
plot(t,y);
grid on;
title('plot of x(t)=2e^a^t for a=1');
stem(t,u);
axis([-5,6,-3,6]);
grid on;
title('unit step signal');
Q.N.3 Plot the impulse function d[n]= {
n=-5:0.5:5;
d=zeros(1,length(n));
d(find(n==0))=1;
subplot(3,3,3);
stem(n,d);
grid on;
axis([-6,6,-1,2]);
title('Impulse function');
Q.N.4 Plot x[n]=a^n for a=2,a=-2,a=0.5,a=-0.5. Analyze the signals for
| |
| |
, positive values of a and negative values of a.
n=-2:0.5:2;
a=2;
x=power(a,n);
subplot(3,3,4);
stem(n,x);
axis([-3,3,-3,6]);
grid on;
title('for a=2');
a=-2;
x=power(a,n);
subplot(3,3,5);
stem(n,x);
axis([-3,3,-3,6]);
grid on;
title('for a=-2');
a=0.5;
x=power(a,n);
subplot(3,3,6);
stem(n,x);
axis([-3,3,-3,6]);
grid on;
title('for a=0.5');
a=-0.5;
x=power(a,n);
subplot(3,3,7);
stem(n,x);
axis([-3,3,-3,6]);
grid on;
title('for a=-0.5');