dsp progremm
DESCRIPTION
progremmTRANSCRIPT
1.Program for discrete time sinusoidal signal?clcclear allclose alln=[-2 -1 0 1 2 3];x=[2 4 5 3 -2 -1];stem(n,x);xlabel('no of samples');ylabel('x(n) ------');title('discete time signal');
2.program to generate an discrete time unit impulse signal.function[del,n]=impseq(n0,n1,n2)n=n1:n2del=[(n-n0)==0]endclcclear allclose alln0=5;n1=-20;n2=20;[del,n]=impseq(n0,n1,n2)stem(n,del);xlabel('n ------>')ylabel('del(n) ---->')title('unit impulse signal')
3. program to generate unit step signal.function[u,n]=unitstep(n0,n1,n2)n=n1:n2u=[(n-n0)>=0]endclcclear allclose alln0=5;n1=-20;n2=30;[u,n]=unitstep(n0,n1,n2)stem(n,u);xlabel(' n------->')ylabel('u(n)----->')title('unit step sequence')
4.program to generate discrete time exponential sequenceclcclear allclose alln1=input('enter the value of n1')n2=input('enter the value of n2')a=input('enter the value of a')n=n1:n2x=a.^nstem(n,x)xlabel('n-------->')ylabel('a^n----->')title('discrete time exponential sequence')
5.program to generate sinusoidal discrete time signal
clcclear allclose alln1=input('enter the value o n1:')n2=input('enter the value of n2:')n=n1:n2x=3*cos((0.5*pi.*n)+(pi/3))+2*sin(0.3*pi.*n)stem(n,x)xlabel('n---->')ylabel('x(n) ----->')title('discrete time sinusiodal signal')
7.program to generate different type of signal.clcclear allclose alln=[-2 -1 0 1 2 3];x=[2 4 5 3 -2 -1];subplot(2,2,1);stem(n,x);xlabel('no of samples');ylabel('x(n) ------');title('discete time signal'); n0=5;n1=-20;n2=20;[del,n]=impseq(n0,n1,n2)subplot(2,2,2);stem(n,del);xlabel('n ------>')ylabel('del(n) ---->')title('unit impulse signal') n0=5;n1=-20;n2=30;[u,n]=unitstep(n0,n1,n2)subplot(2,2,3);stem(n,u);xlabel(' n------->')ylabel('u(n)----->')title('unit step sequence') n1=input('enter the value of n1')n2=input('enter the value of n2')a=input('enter the value of a')n=n1:n2x=a.^nsubplot(2,2,4)stem(n,x)xlabel('n-------->')ylabel('a^n----->')title('discrete time exponential sequence')