Dsp Manual
-
Upload
sethu-naidu -
Category
Documents
-
view
172 -
download
2
Transcript of Dsp Manual
2011
By- Ashutosh
www.citystudentsgroup.blogspot.com
1/5/2011
DSP LAB PROGRAM MANUAL
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 2
CONTENTS 1. SAMPLING THEOREM………………………………………………………..1-3
2. IMPULSE RESPONSE………………………………………………………….3-4
3. LINEAR CONVOLUTION……………………………………………………..4-8
4. CIRCULAR CONVOLUTION OF TWO GIVEN SEQUENCE……………..8-9
5. N-POINT DFT…………………………………………………………………...9-10
6. LINEAR CONVOLUTION USING DFT&IDFT……………………………..11-11
7. CIRCULAR CONVOLUTION USING DFT&IDFT…………………………12-12
8. AUTOCORRELATION………………………………………………………...12-16
9. CROSSCORRELATION……………………………………………………….16-19
10. FIR FILTER……………………………………………………………………..19-23
11. IIR FILTER DESIGN…………………………………………………………...23-26
12. SOLVING A DIFFERENCE EQUATION…………………………………….27-30
CCS PROGRAMMING
1. LINEAR CONVOLUTION………………………………………………………31-31
2. CIRCULAR CONVOLUTION…………………………………………………..31-32
3. COMPUTATION OF N-POINT DFT…………………………………………...32-32
4. IMPULSE RESPOSE OF THE DIFFERENT ORDER SYSTEM…………….32-33
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 3
1.VERIFICATION OF SAMPLING THEOREM:
tfinal=0.05; t=0:0.00005:0.05; fd=input(‘enter analog frequency'); xt=sin(2*pi*fd*t); subplot(3,3,1); plot(t,xt); fs1=1.3*fd; n1=0:1/fs1:tfinal; xn=sin(2*pi*n1*fd); subplot(3,3,1); plot(t,xt,'b',n1,xn,'r*-'); title('undersampling plot'); fs2=2*fd; n2=0:1/fs2:tfinal; xn=sin(2*pi*fd*n2); subplot(3,3,2); plot(t,xt,'b',n2,xn,'r*-'); title('nyquist plot'); fs3=5*fd; n3=0:1/fs3:tfinal; xn=siin(2*pi*fd*n3); subplot(3,3,3); plot(t,xt,'b',n3,xn,'r*-'); title('oversampling plot'); xlabel('time'); ylabel('amplitude'); legend('analog','discrete');
Result:
enter analog frequency 200
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 4
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 5
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 6
2.IMPULSE RESPONSE OF A GIVEN SYSTEM:
y=input('the output sequence y(n) of the system ='); x=input('the input sequence of the sysytem ='); h=deconv(y,x); disp('the impulse response of the system is ='); disp(h); N=length(h); n=0:1:N-1; stem(n,h); xlabel('time index n'); ylabel('amplitude'); title('impulse response of a sysytem'); yv= conv(x,h); disp('the verified output sequence is'); disp(yv);
RESULT:
the output sequence y(n) of the system =[1 2 1 1 0 -1]
the input sequence of the sysytem =[1 1 1 1]
the impulse response of the system is =
1 1 -1
the verified output sequence is
1 2 1 1 0 -1
GRAPH:
3.LINEAR CONVOLUTION OF TWO GIVEN SEQUENCE:
LEVEL-1: RIGHT SIDED
x1=input('enter first sequence'); x2=input('enter second sequence'); y=conv(x1,x2);
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 7
disp('linear convolution of x1&x2 is y='); disp(y); subplot(2,2,1); stem(y); xlabel('time index n'); ylabel('amplitude'); title('convolution output'); subplot(2,2,2); stem(x1); xlabel('time index n'); ylabel('amplitude'); title('plot of x1'); subplot(2,2,3); stem(x2); xlabel('time index n'); ylabel('amplitude'); title('plot of x2');
RESULT:
enter first sequence [1 2 3 4]
enter second sequence [2 3 2 4]
linear convolution of x1&x2 is y=
2 7 14 25 26 20 16
GRAPH:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 8
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 9
LEVEL-2: TWO SIDED SEQUENCE x1=[1 2 3 2 1 3 4]; n1=-3:3; x2=[2 -3 4 -1 0 1]; n2=-1:4; ybegin=n1(1)+n2(1); yend=n1(length (x1))+ n2(length(x2)); ny=[ybegin:yend]; y=conv(x1,x2); disp('linear convolution of x1&x2 is y='); disp(y); subplot(2,2,1); stem(ny,y); xlabel('time index n'); ylabel('amplitude'); title('convolution output'); subplot(2,2,2); stem(n1,x1); xlabel('time index n'); ylabel('amplitude'); title('plot of x1'); subplot(2,2,3); stem(n2,x2); xlabel('time index n'); ylabel('amplitude'); title('plot of x2');
RESULT:
linear convolution of x1&x2 is y=
2 1 4 2 6 9 3 2 15 -3 3 4
GRAPH:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 10
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 11
4. CIRCULAR CONVOLUTION OF TWO GIVEN SEQUENCE:
x=[1 2 3 4];
h=[1 2 3 4]; N= max(length(x),length(h)); 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 x1&x2 is y=');
disp(y); n1=0:N-1;
title('circular convolution output y(n)');
5.COMPUTATION OF N-POINT DFT OF A GIVEN SEQUENCE AND TO PLOT
MAGNITUDE AND PHASE SPECTRUM:
x=[1 2 3 6]; N=4; xk=fft(x,N); n=0:1:N-1; figure(1); stem(n,abs(xk)); xlabel('k'); ylabel('|x(k)|'); title('magnitude spectrum'); figure(2); stem(n,angle(xk)); xlabel('k'); ylabel('angle(xk)'); title('phase spectrum'); figure(3); n1=0:1:length(x)-1; stem(n1,x); xlabel('n'); ylabel('x[n]'); title('original signal');
GRAPHS:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 12
DSP LAB
©Brought to you by www.citystudentsgroup.blogspot.com
6.LINEAR CONVOLUTION OF TWO GIVEN SEQUENCES USING
LINEAR CONVOLUTION:
x1=[1 2 3 4]; x2=[1 2 3 4]; N=length(x1)+length(x2)-1; X1=fft(x1,N); X2=fft(x2,N); y=X1.*X2; yn=ifft(y,N); disp('linear convolution of x1 & x2 is yn='disp('yn'); disp('output using convolution'yv=conv(x1,x2); disp(yv); stem(yn); title('linear convolution output y(n)'
RESULT:
linear convolution of x1 & x2 is yn=
yn
output using convolution
1 4 10 20 25 24 16
DSP LAB PROGRAM MANUAL
Brought to you by www.citystudentsgroup.blogspot.com
LINEAR CONVOLUTION OF TWO GIVEN SEQUENCES USING DFT
'linear convolution of x1 & x2 is yn=');
'output using convolution');
'linear convolution output y(n)');
linear convolution of x1 & x2 is yn=
1 4 10 20 25 24 16
Page 13
DFT AND IDFT:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 14
GRAPH:
7.CIRCULAR CONVOLUTION OF TWO GIVEN SEQUENCES USING DFT AND
IDFT:
x1=[1 2 3 4]; x2=[1 2 3 4]; N=max(length(x1),length(x2)); X1=fft(x1,N); X2=fft(x2,N); y=X1.*X2; yn=ifft(y,N); disp('linear convolution of x1 & x2 is yn='); disp('yn'); stem(yn); title('linear convolution output y(n)');
RESULT:
Circular convolution of x1 & x2 is yn=
26 28 26 20
GRAPHS:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 15
8.GENERATION OF AUTOCORRELATION SEQUENCE:
X=[3 -1 2 1]; Y=Xcorr(X); Y=conv(x,fliplr(X)); disp('autocorrelated sequence'); disp('y'); figure(1); stem(y); title('generation of autocorrelation sequence');
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 16
n=∞
∞
8.1-For ENERGY Signal:
Properties of Autocorrelation:
1. Autocorrelation is an even function. 2. At zero lag at l=0, the sample value of the autocorrelation sequence
has its maximum value which is equal to energy of the signal.
Yxx[0]= Σx = Σx2[n]
3. The autocorrelation sequence of noise corrupted signal is also periodic in nature.
MATLAB IMPLEMENTATION:
n=-5:5; N=10; x1=ones(1,11); Y=xcorr(x1); disp('autocorrelated sequence'); disp('y'); figure(2); subplot(2,1,1); stem(n,x1); title('square sequence'); subplot(2,1,2); k=-N:N; stem(k,Y); title('autocorrelated output'); xlabel('lag index');
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 17
ylabel('lag index');
8.2-Autocorrelation for Second sequence:
N=30; n=1:N; x=cos(pi*0.25*n); d=rand(1,N)-0.5; y=x+d; r=conv(y,fliplr(y)); [ry,lag]=xcorr(y); [rn,lag1]=xcorr(d); figure(1); subplot(3,1,1); stem(x); title('reference sinusoidal sequence'); subplot(3,1,2); stem(y); title('noise corrupted signal'); subplot(3,1,3); stem(lag,r); title('autocorrelation seq of corrupted signal'); xlabel('lag index'); ylabel('amplitude');
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 18
figure(2); stem(lag1,rn); title('autocorrelation seq of noise'); xlabel('lag index'); ylabel('amplitude');
GRAPHS:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 19
9.CROSSCORRELATION: x=input('type in the reference sequence ='); y=input('type in the second seq='); n1=length(y)-1; n2=length(x)-1; r=conv(x,fliplr(y)); disp('crosscorrelation output is='); disp(r); k=(-n1):n2; stem(k,r); xlabel('lag index'); ylabel('amplitude');
RESULT:
type in the reference sequence =[1 3 -2 1 2 -1 4 4 2]
type in the second seq=[2 -1 4 1 -2 3]
crosscorrelation output is=
3 7 -11 14 13 -15 28 6 -2 21 12 12 6 4
GRAPH:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 20
Properties-1 ( ryx(l) = rxy(l)) xr=[1 2 3 -1]; x2=[3 -1 1 2]; [r1,l1]=xcorr(xr,x2); stem(l1,r1); disp(r1); [r2,l2]=xcorr(x2,xr); stem(l2,r2); disp(r2);
RESULT:
2.0000 5.0000 7.0000 2.0000 2.0000 10.0000 -3.0000
-3.0000 10.0000 2.0000 2.0000 7.0000 5.0000 2.0000
GRAPH:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 21
Properties-2:
x1=[1 2 3 -2 0 0]; x2=[0 0 1 2 3 -1]; y=xcorr(x1,x2); disp(y); subplot(1,1,1); stem(y);
RESULT:
-1.0000 1.0000 5.0000 16.0000 2.0000 -1.0000 -2.0000 0 0.0000 -0.0000
0.0000
-1.0000 1.0000 5.0000 16.0000 2.0000 -1.0000 -2.0000 0 0.0000 -0.0000
0.0000
GRAPH:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 22
10.FIR FILTER USING HAMMING WINDOW COMMAND:
METHOD-1
h=fir1(33,150/(1000/2),hamming(34)); figure(1); [m,w]=freqz(h,1,128); mag=20*log10(abs(m)); plot(w,mag); title('fir filter frequency response '); grid; n=1:30; f1=50;f2=300;f3=200;fs=1000; x=[]; x1=sin(2*pi*n*f1/fs); x2=sin(2*pi*n*f2/fs); x3=sin(2*pi*n*f3/fs); x=[x1 x2 x3]; figure(2); subplot(2,1,1); stem(x); title('input'); y=conv(h,x); -----------OR USE COMMAND y=filter(h,1,x); subplot(2,1,2); stem(y); title('output');
RESULT:
ans =
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 23
4
GRAPHS:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 24
METHOD-2
wpa=input('enter passband freq in hz='); wsa=input('enter stopband freq in hz='); ws1=input('enter sampling freq in hz='); wpd=2*pi*wpa/ws1; wsd=2*pi*wsa/ws1; tb=wsd-wpd; N=ceil(6.6*pi/tb); wc=(wsd+wpd)/2; wc=wc/pi; hw=hamming(N+1); figure(1); stem(hw); title('fir filter window sequence hamming window'); h=fir1(N,wc,hamming(N+1)); figure(2); [m,w]=freqz(h,1,128); mag=20*log10(abs(m)); plot(w,mag); title('fir filter frequency response '); grid; figure(3); n=1:30; f1=50;f2=300;f3=200;fs=1000; x=[]; x1=sin(2*pi*n*f1/fs); x2=sin(2*pi*n*f2/fs);
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 25
x3=sin(2*pi*n*f3/fs); x=[x1 x2 x3]; subplot(2,1,1); stem(x); title('input'); y=conv(h,x);-----------OR USE COMMAND y=filter(h,1,x); subplot(2,1,2); stem(y); title('output');
RESULT:
ans =
4
enter passband freq in hz=100
enter stopband freq in hz=200
enter sampling freq in hz=1000
GRAPHS:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 26
11. IIR FILTER DESIGN USING BUTTERWORTH AND CHEBYSHEV:
close all;
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 27
clear all; [b,a]=butter(2,150/(1000/2));---FOR CHEBYSHEV ONLY CHNGE butter TO cheby1 [num,den]=bilinear(b,a,1); n=1:30; f1=100;f2=300;f3=170;fs=1000; x=[]; x1=sin(2*pi*n*f1/fs); x2=sin(2*pi*n*f2/fs); x3=sin(2*pi*n*f3/fs); x=[x1 x2 x3]; figure(1); subplot(2,1,1); stem(x); title('input'); y=filter(num,den,x); subplot(2,1,2); stem(y); title('output'); figure(2); [m,w]=freqz(num,den,128); mag=20*log10(abs(m)); plot(w,mag); grid;
GRAPHS:
Frequency response
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 28
METHOD-2: close all; clear all; rp=1; rs=40; w1=800; w2=1200; ws=3600; aw1=2*pi*w1/ws; aw2=2*pi*w2/ws; pw1=2*tan(aw1/2); pw2=2*tan(aw2/2); [n,wc]=buttord(pw1,pw2,rp,rs,'s'); [b,a]=butter(n,wc,'s'); fs=1; [num,den]=bilinear(b,a,1); figure(1); [mag,freq1]=freqz(num,den,128); freq=freq1*ws/(2*pi); m=20*log10(abs(mag)); plot(freq,m) title('frequency response'); grid; n=1:30; f1=100;f2=300;f3=170;fs=1000; x=[]; x1=sin(2*pi*n*f1/fs); x2=sin(2*pi*n*f2/fs); x3=sin(2*pi*n*f3/fs); x=[x1 x2 x3];
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 29
figure(2); subplot(2,1,1); stem(x); title('input'); y=filter(num,den,x); subplot(2,1,2); stem(y); title('output'); figure(2);
GRAPHS:
Graph for input and output:
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 30
12.SOLVING A GIVEN DIFFERENCE EQUATION
Y(n)-y(n-1)+0.9y(n-2)=x(n)
12.1-IMPULSE RESPONSE
close all; clear all; N=input('length of response required'); b=[1]; a=[1 -1 0.9]; x=[1,zeros(1,N-1)]; n=0:1:N-1; h=filter(b,a,x); subplot(2,1,1); stem(n,x); title('impulse input'); xlabel('n'); ylabel('y(n)'); subplot(2,1,2); stem(n,h); title('impulse response'); xlabel('n'); ylabel('h(n)');
GRAPH FOR LENGTH:
length of response required 100
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 31
12.2-STEP RESPONSE: close all; clear all; N=input('length of response required'); b=[1]; a=[1 -1 0.9]; x=[ones(1,N)]; n=0:1:N-1; y=filter(b,a,x); subplot(2,1,1); stem(n,x); title('step input'); xlabel('n'); ylabel('u(n)'); subplot(2,1,2); stem(n,y); title('step response'); xlabel('n'); ylabel('y(n)');
GRAPH FOR LENGTH=50
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 32
12.3-STEADY STATE:
close all; clear all; N=input('length of response required'); b=[1]; a=[1 -1 0.8]; n=0:1:N-1; x=cos(0.05*pi*n); y=filter(b,a,x); subplot(2,1,1); stem(n,x); title('steady input'); xlabel('n'); ylabel('u(n)'); subplot(2,1,2); stem(n,y); title('steady response'); xlabel('n'); ylabel('y(n)');
RESULT FOR LENGTH=100
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 33
12.4-WITH INITIAL CONDITION:
b=[1/3 1/3 1/3]; a=[1 -0.95 0.9025]; Y=[-2 -3]; X=[1 1]; xic=filtic(b,a,Y,X); n=0:7; x=cos(pi*n/3); y=filter(b,a,x,xic); disp(y);
RESULT:
1.8075 4.3555 2.8398 -1.5664 -4.7176 -3.4014 1.3596 5.0281
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 34
PROGRAMMING IN CCS:
FOR CCS PROGRMMING USE THE CCS SOFTWARE:
1. To perform linear convolution for the given sequence. #include<stdio.h> #include<math.h> main() float h[4]={2,2,2,2}; float x[4]={1,2,3.4}; float y[10]; int xlen=4; int hlen=4; int N=xlen+hlen-1; int k,n; for(n=0;n<N;k++) { y[n]=0; for(k=0;k<hlen;k++) { if(((n-k)>=0)&((n-k)<xlen)) y[n]=y[n]+h[k]*x[n-k]; } printf("%f\t",y[n]); } } RESULT: 2 6 12 20 18 14 8
EXPERIMENT-2;
CIRCULAR CONVOLUTION FOR ANY TWO GIVEN SEQUENCE:
#include<stdio.h> #include<math.h> main() float x[5]={1,2,3,4,5}; float h[5]={1,2,3,4,5}; float y[10]; int N=5; int k,n,i; for(n=0;n<N;n++) { y[n]=0; for(k=0;k<N;k++) { i=(n-k)%N; if(i<0) i=i+N; y[n]=y[n]+h[k]*x[i]; } printf("%f\t",y[n]);
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 35
} }
RESULT:
41 51 51 46 36
3. COMPUTATION OF N-POINT DFT OF THE GIVEN EQUATION: #include<stdio.h> #include<math.h> main() { flot y[16]; float x[4]={1,3,2,5}; float w; int n,k,k1,N=8,xlen=4; for(k=0;k<2*N;k=k+2) { y[k]=0; y[k+1]=0; k=k1/2; for(n=0;n<xlen;n++) { w=-2*3.14*k1*n/N; y[k]=y[k]+x[n]*cos(w); y[k+1]=y[k+1]+x[n]*sin(w); } printf("%f+j%f\n",y[k+1]); } }
RESULT:
Result will come in complex form like-
11+j0.00 -0.40755+j-7.66 etc
4. TO FIND THE IMPULSE RESPONSE OF THE GIVEN FIRST ORDER/SECOND
ORDER SYSTEM:
#include<stdio.h> float x[60],y[60]; main() { float a1,a2,b0,b1,b2; int i,j,N=20; a1=-1.1430; a2=0.4128; b0=0.0675; b1=0.1349; b2=0.0675; x[0]=1; for(i=1;i<N;i++) {
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 36
y[j]=b0*x[j]; if(j>0) y[j]=y[j]+b1*x[j-1]-a1*y[j-1]; if((j-1)>0) y[j]=y[j]+b2*x[j-2]-a2*y[j-2]; printf("%f\t",y[j]); } }
RESULT: it will be only real valued as well as imaginary valued.
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 37
DIGITAL SIGNAL PROCESSING(DSP) VIVA QUESTIONS:
1. What is sampling theorem?
2. What do you mean by process of reconstruction.
3. What are techniques of reconstructions.
4. What do you mean Aliasing? What is the condition to avoid aliasing for sampling?
5. Write the conditions of sampling.
6. How many types of sampling there?
7. Explain the statement-
t= 0:0.000005:0.05
8. In the above example what does colon (:) and semicolon (;) denotes.
9. What is a) Undersampling b) nyquist plot c) Oversampling.
10. Write the MATLAB program for Oversampling.
11. What is the use of command ‘legend’?
12. Write the difference between built in function, plot and stem describe the function.
13. What is the function of built in function and subplot?
14. What is linear convolution?
15. Explain how convolution syntax built in function works.
16. How to calculate the beginning and end of the sequence for the two sided controlled
output?
17. What is the total output length of linear convolution sum.
18. What is an LTI system?
19. Describe impulse response of a function.
20. What is the difference between convolution and filter?
21. Where to use command filter or impz, and what is the difference between these two?
22. What is the use o function command ‘deconv’?
23. What is the difference between linear and circular convolution?
24. What do you mean by statement subplot (3,3,1).
25. What do you mean by command “mod” and where it is used?
26. What do you mean by Autocorrelation and Crosscorrelation sequences?
27. What is the difference between Autocorrelatio and Crsscorrelation.
28. List all the properties of autocorrelation and Crosscorrelaion sequence.
29. Where we use the inbuilt function ‘xcorr’ and what is the purpose of using this function?
30. How to calculate output of DFT using MATLAB?
31. What do you mean by filtic command, explain.
32. How to calculate output length of the linear and circular convolution.
33. What do you mean by built in function ‘fliplr’ and where we need to use this.
34. What is steady state response?
35. Which built in function is used to solve a given difference equation?
36. Explain the concept of difference equation.
37. Where DFT is used?
38. What is the difference between DFT and IDFT?
39. What do you mean by built in function ‘abs’ and where it is used?
40. What do you mean by phase spectrum and magnitude spectrum/ give comparison.
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 38
41. How to compute maximum length N for a circular convolution using DFT and
IDFT.(what is command).
42. Explain the statement- y=x1.*x2
43. What is FIR and IIR filter define, and distinguish between these two.
44. What is filter?
45. What is window method? How you will design an FIR filter using window method.
46. What are low-pass and band-pass filter and what is the difference between these two?
47. Explain the command – N=ceil(6.6*pi/tb)
48. Write down commonly used window function characteristics.
49. What is the matlab command for Hamming window? Explain.
50. What do you mea by cut-off frequency?
51. What do you mean by command butter, cheby1?
52. Explain the command in detail- [N,wc]=buttord(2*fp/fs,2*fstp/fs,rp,As)
53. What is CCS? Explain in detail to execute a program using CCS.
54. Why do we need of CCS?
55. How to execute a program using ‘dsk’ and ‘simulator’?
56. Which IC is used in CCS? Explain the dsk, dsp kit.
57. What do you mean by noise?
58. Explain the program for linear convolution for your given sequence.
59. Why we are using command ‘float’ in CCS programs.
60. Where we use ‘float’ and where we use ‘int’?
61. Explain the command- i=(n-k)%N
62. Explain the entire CCS program in step by step of execution.
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 39
*QUESTIONS WHICH WILL BE ASKED IN THE EXAMINATION WILL BE IN THE
FORM OF LIKE THIS
DSP LAB QUESTIONS
1. Write a MATLAB program so that output signal is sampled with a rate a) greater than
twice the max frequency content in the input signal and b) for equal to maximum
frequency content in the input signal. Given input signal is a cos function and the spacing
between the samples is 50µs and total time duration is 0.05 seconds.
2. Write a MATlAB program to find the system function of the causal LTI system with
input x(z)= 1+2z-1
+2z-2
+z-3
and output y(z)= 1+z-1
+2z-2
+z-3
so plot input, output and
impulse response.
3. Write a MATLAB program to find convolution of unit imulse function with X(z)= 1+3z-
1+4z
-2 and convoluted output length is equal to sum of two input lengths-1.
4. Write a MATLAB program to find the output of given system whose frequency response
is Y(z)= X(z).H(z) and given x(n)= (1,2,3,4), h(n)= (1,2,3,4) and output length is equal to
maximum length of x(n) and h(n).
5. Write a MATLAB program to find convolution of two given sequences in time domain
X1(z)= 1+2z-1
+3z-2
& X2(z)= 2+z-1
+4z-2
and convoluted output length is equal to sum of
two input lengths minus one.
6. Write a MATLAB program to find the similarities between the given sequence x(n)=
Sin(2*pi*n/N) for N=4 and the time shifted version of same sequences in terms of
convolution and write and verify a) Energy property b) periodicity property and draw the
graph for the same.
7. Write a program using MATLAB code for the received signal replected from the target is
the delayed uerreon of the transmitted signal. Assume delay in two time units. Assume
transmitted signal is {3, -1, 2, 1}.
8. Write a MATLAB program to find the similarities between the two given sequence X1
(n)= [1 3 -2 1 2 -1 4 4 2] and X2(n)= [2 -1 4 1 -2 3] is its time shifted version which is
shifted by two units, in terms of convolution and prove i) ϒxy[l]= ϒxy[-l] and 2) cross
correlation of two sequences x(n) and y(n)= x(n-k) is having peak at the value of k.
9. Write a MATLAB program to find the steady state response for the given difference
equation y(n)-0.8y(n-1)=x(n) and x(n)= cos(0.05*pi*n); n=0 to N-1 where N=20 and plot
the respective graph.
10. Write a MATLAB program to find the first 8 samples of the complete response y(n) for
the difference equation y[n]= 1/3 {x[n]+x[n-1]+x[n-2]}+0.95y[n-1]-0.9025y[n-2]; n>=0
where x(n)=cos(n*pi/3)u(n) and initial conditions are y[-1]=-2, y[-2]=-3, x[-1]=1, x[-
2]=1.
11. Write a MATLAB program to find the impulse response of a given difference equation
y(n)+0.8y(n-2)+0.6y(n-3)=x(n)+0.7x(n-1)+0.5x(n-2). Plot the graph for N=20.
12. Find steady state response using MATLAB for the difference equation y(n)-0.8y(n-1)=
x(n) and x(n)= Cos(wn); n=0 to N-1 where N=20.
13. Write a MATLAB program to find the multiplication of two frequencies domain
aperiodic signals in the domain x1=[1 1 1 1] and x2=[1 2 3 4].
DSP LAB PROGRAM MANUAL
©Brought to you by www.citystudentsgroup.blogspot.com Page 40
14. Write a MATLAB program to find the multiplication of the two frequency domain
periodic signals in time domain x1=[1 1 1 1] and x2=[1 2 3 4].
15. Design an FIR filter for the given order of filter is 33 and cut-off frequency is 150Hz and
sampling frequency is 1KHz and having stop band attenuation 21dB. Implement the same
filter with assumed sinusoidal input.
16. Write a MATLAB program to design an FIR filter is 2 and cut-off frequency is 150 and
sampling frequency is 1KHz and having minimum stop band attenuation 44dB, Write a
MATLAB program to implement the same filter with assumed sine input.
17. Design an IIR filter for the pass band edge frequency w1=800 and stop band edge
frequency w2=1200. sampling frequency ws=3600, passband ripple 1dB and stopband
attenuation 40dB by using butterworth filter and maps it with bilinear transform. Find and
plot the magnitude and frequency response. Implement with 3 various sinusoidal input
signals of your own specification.
CCS PROGRAM:
18. Linear convolution of a given sequence.
19. Circular convolution of two sequences.
20. Computation of N-point DFT for given value of N.
21. Impulse response of given first order or second order filter.