Thursday, September 26, 2013

Unit step and Ramp Function in MATLAB

 Ramp function :

Code:

function ramp(L)

n=-L:L;

x=zeros(1,length(n));

for i=1:L
   
x(L+1+i)=i;

end

stem(n,x)


grid on











Unit step function :

 Code:

function ustep(L)

n=-L:L;

x=zeros(1,length(n));

for i=1:L
   
x(L+i)=1;

end

stem(n,x)
















No comments:

Post a Comment