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:
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:
SOURCE CODE(PART-II):
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:
Index of DSP Lab Manual.