Académique Documents
Professionnel Documents
Culture Documents
clc;
close all;
clear all;
%%%%impulse function
n=-5:5;
x=[];
for i=1:length(n)
if n(i)==0
x=[x 1];
else
x=[x 0];
end
end
subplot(3,2,1)
stem(n,x)
title('impulse function')
xlabel('n------>')
ylabel('delta function')
SOURABH BANSAL
511/ECE/07
%%%%%ramp function
n=0:5;
x=[];
for i= 1:length(n)
if n(i)>=0
x=[x x];
else
x= [x 0];
end
end
subplot(3,2,3)
stem(n,n)
title('ramp function')
xlabel('n---->')
ylabel(' ramp function')
%%%%%%sin function
n=-2*pi:pi/8:2*pi;
x=sin(n);
subplot(3,2,4)
stem(n,x)
title('sin function')
xlabel('n(radian)---->')
ylabel('sin function')
%%%%cosine function
n=-2*pi:pi/8:2*pi;
x=cos(n);
subplot(3,2,5)
stem(n,x)
title('cosine function')
xlabel('n(radian)--->')
ylabel('cos function')
%%%%exponential function
SOURABH BANSAL
511/ECE/07
n=0:0.5:6;
x=[];
for i=1:length(n)
x(i)=exp(n(i));
end
subplot(3,2,6)
stem(n,x)
title('exp function')
xlabel('n(radian)---->')
ylabel('exp function')
SOURABH BANSAL
511/ECE/07
OUTPUT:-
step function
0.5 0.5
0 0
-5 0 5 -5 0 5
n------> n----->
ramp function sin function
ramp function
5 1
sin function 0
0 -1
0 2 4 6 -10 -5 0 5 10
n----> n(radian)---->
cosine function exp function
1 500
cos function
exp function
-1 0
-10 -5 0 5 10 0 2 4 6
n(radian)---> n(radian)---->
SOURABH BANSAL
511/ECE/07