×

# Lab Manuals for Digital Signal Processing - DSP By harini nadig.S

• Digital Signal Processing - DSP
• Practical
• Visvesvaraya Technological University Regional Center - VTU
• Electronics and Communication Engineering
• 35 Views
0 User(s)

#### Text from page-1

Digital signal processing manual CIRCULAR CONVOLUTION %circular convolution program% x=[1 2 3 4] h=[1 2 3 4] N=max(length(x),length(h)); %compute the output for n=0:N-1 y(n+1)=0; for k=0:N-1 i=mod((n-k),N); if (i<0) i=i+N; end y(n+1)=y(n+1)+(h(k+1)*x(i+1)); end end disp('circular convolution of x and h is y='); disp(y); %plot n1=0:N-1; stem(n1,y); xlabel('time index n'); ylabel('amplitude'); title('circular convolution output y(n)'); 2017

#### Text from page-2

Digital signal processing manual LINEAR CONVOUTION clc; clear all; close all; x=input('enter the first sequence'); h=input('enter the second sequence'); y=conv(x,h); figure; subplot(3,1,1); stem(x); ylabel('Amplitude--'); xlabel('(a)n--.'); title('first sequence'); subplot(3,1,2); stem(h); ylabel('Amplitude--'); xlabel('(b)n--.'); title('second sequence'); subplot(3,1,3); stem(y); ylabel('Amplitude--'); xlabel('(c)n--.'); title('convoluted sequence'); disp('the resultant signal is'); 2017

#### Text from page-3

Digital signal processing manual IDFT clc; close all; clear all; xn=input('Enter the sequence x(n)'); ln=length (xn); xk=zeros(1,ln); ixk=zeros(1,ln); for k=0:ln-1 for n=0:ln-1 xk(k+1)=xk(k+1)+(xn(n+1)*exp((-i)*2*pi*k*n/ln)); end end t=0:ln-1; subplot(221); stem(t,xn); grid ylabel('Amplitude'); xlabel('Time Index'); title('Input sequence'); magnitude=abs(xk); t=0:ln-1; subplot(222); stem(t,magnitude); grid ylabel('Amplitude'); xlabel('K'); title('magnitude response'); phase=angle(xk); t=0:ln-1; subplot(223); stem(t,phase); grid ylabel(phase'); xlabel('K'); title('phase response'); for k=0:ln-1 for n=0:ln-1 ixk(k+1)=ixk(k+1)+(xn(n+1)*exp((-i)*2*pi*k*n/ln)); end end ixk=ixk./ln; t=0:ln-1; subplot(224); stem(t,xn); grid ylabel('Amplitude'); xlabel('Time Index'); title('IDFT sequence'); 2017

#### Text from page-4

Digital signal processing manual BUTTERWORTH clc; close all; clear all; format long rp=input('enter the passband ripple'); rs=input('enter the stopband ripple'); wp=input('enter the passband freq'); ws=input('enter the stopband freq'); fs=input('enter the sampling freq'); w1=2*wp/fs;w2=2*ws/fs; [n,wn]=buttord(w1,w2,rp,rs,'s'); [z,p,k]=butter(n,wn); [b,a]=zp2tf(z,p,k); [b,a]=butter(n,wn,'s'); w=0:.01:pi; [h,om]=freqs(b,a,w); m=20*log10(abs(h)); an=angle(h); subplot(2,1,1);plot(om/pi,m); ylabel('gain in db-->'); xlabel('(a) normalised frequency-->'); subplot(2,1,2); plot(om/pi,an); xlabel('(b) normalised frequency-->'); ylabel('phase in radians-->'); 2017