OBJECT: Generate a unit step sequence with n sample. Generate a sinusoidal sequence with 1 period. Use the function sin(0.1*pi*n). Generate an exponential sequence (0.8)^n. Add two sinusoidal sequences sin(0.1*pi*n) and sin(0.2*pi*n). Use “subplot” to plot all the sequence.
SOURCE CODE:
s=input('Enter the no. of samples: '); n=0:1:(s-1); y1=[ones(1,s)]; subplot(2,2,1); stem(n,y1); y2=sin(0.1*pi*n); subplot(2,2,2); stem(n,y2); y3=exp(.8.^n); subplot(2,2,3); stem(n,y3); y4=sin(.1*pi*n); y5=sin(.2*pi*n); y6=y4+y5; subplot(2,2,4); stem(n,y6);
OUTPUT:
Enter the no. of samples: 40
OUTPUT GRAPH:
![Add two sinusoidal sequences sin(0.1*pi*n) and sin(0.2*pi*n).](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicOPmXj4dpdsFn05Bl5lV1IwwGeWexiNd5FQHtiJtcvkfmI71rP2flmLoGRgkZCsI2iNEFDRjvkyXRYzRdVwUkJ-1RsetrQW2lKyrLNrRmGKwp4PylDotvP61YxdKtOCV3vR2xE7Shb01q/s1600/Assignment2_1.jpg)
PROGRAM 2:
OBJECT: Generate a unit impulse sequences ∂0 (n+4) and ∂0 (n-3).
SOURCE CODE(PART-I):
n=-10:20; x=[zeros(1,6) 1 zeros(1,24)]; % zeros(N) is an N-by-N matrix of zeros. stem(n,x); xlabel('time index n'); ylabel('amplitude'); title('advanced impulse response'); axis([-10 20 0 1]);
OUTPUT GRAPH:
![Generate a unit impulse sequences ∂0 (n+4) and ∂0 (n-3) (Part-I).](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii7NK41-8YJCI6F0P7JMCxSv9310WTXTZBkZqj0SLgVVyltswfhgrMB4G5TSOZQwDzxtBUb_KhAUkhBJz3J-IEb-wTsZ1EMSrU1-lOY-z3n2HF1nMGFQguA1FZ6aaizlXCZmSzj4oXrPxZ/s1600/Assignment2_2P1.jpg)
z=-10:20; x=[zeros(1,13) 1 zeros(1,17)]; stem(n,x); xlabel('Time index n'); ylabel('Amplitude'); title('Delayed impulse response'); axis([-10 20 0 1]);
OUTPUT GRAPH:
![Unit impulse sequences (Part-II)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidWtMiC-IO8bbdHjrVDqknXPkeTCfb752EvznlN1zHIoFNncY-smJsIN-a9ubTx88GCQNXXVZcQrKrGSc6HUZvLkOs2T_Q5AueKu70rkxlu98aKvUnOqbG5uCC3cP1998PMgQogJdI9sa_/s1600/Assignment2_2P2.jpg)
Index of DSP Lab Manual.