Sei sulla pagina 1di 1

%Experiment 1:Plot various Discrete Time sequence

t=-10:1:10;
y=1*[zeros(1,10) ones(1,1) zeros(1,10)];%Putting value unity at n=0 only
subplot(5,1,1);
d=stem(t,y); %Plotting Impulse Sequence
axis([-10,10,-0.5,1.2]); %Giving axis values
title('Impulse sequence');
xlabel('<----n---->');
ylabel('delta(n)');
set (d,'linewidth',2.5); %Setting width of line
grid on;
t=-10:1:10;
y=[zeros(1,10) ones(1,11)]; %Putting valus for n>=0 unity
ans zero for n<0
subplot(5,1,2);
d=stem(t,y); %Plotting Unit Step sequence
axis([-10,10,-0.2,1.2]); %Giving axis values
title('Discrete Unit Step sequence');
xlabel('<----n---->');
ylabel('u(n)');
set (d,'linewidth',2.5); %Setting width of line
grid on;
t=0:1:10;
x=t;
subplot(5,1,3);
d=stem(t,x); %Plotting Unit Ramp sequence
axis on;
axis([-10,10,-2,10]); %Giving axis values
title('Discrete Unit Ramp sequence');
xlabel('<----n---->');
ylabel('r(n)');
set (d,'linewidth',2.5); %Setting width of line
grid on;
x=0:0.2:10;
a=1.5; %Setting value 0f a=1.5
z=a.^x; %Giving z=(a power x)
subplot(5,1,4);
d=stem(x,z); %Plotting Exponential sequence
for a>1
title('Discrete Exponential sequence for a>1');
xlabel('<----n---->');
ylabel('exp(x)');
set (d,'linewidth',2.5); %Setting width of line
grid on;
x=0:0.2:10;
a=0.5; %Setting value 0f a=1.5
z=a.^x; %Giving z=(a power x)
subplot(5,1,5);
d=stem(x,z); %Plotting Exponential sequence
for 0<a<1
title('Discrete Exponential sequence for 0<a<1');
xlabel('<----n---->');
ylabel('exp(x)');
set (d,'linewidth',2.5); %Setting width of line
grid on;

Potrebbero piacerti anche