MATLAB programs to generate and plot the following discrete time sequences: (a)
unit sample sequence del(n), (b) unit step sequence u(n), (c) ramp sequence r(n), (d) real-valued
exponential sequence x(n) = (0.8)^n u(n) for 0 < n < 50.
n=-10:10;
deltan=1.*(n==0);
subplot(411);
stem(n,deltan,".");
xlabel("n"); ylabel("delta");
title("delta func");
%unit stepfunction
step=1.*(n>=0);
subplot(412);
stem(n,step,".");
xlabel("n"); ylabel("u(n)");
title("unit step func");
%unit ramp
ramp=n.*(n>=0);
subplot(413);
stem(n,ramp,".");
xlabel("n"); ylabel("r(n)");
title("unit ramp func");
%exponential signal
n=0:50;
xn=0.8.^n;
subplot(414);
stem(n,xn,".");
xlabel("n"); ylabel("x(n)");
title("unit exp func");
Comments
Post a Comment