ec56 digital signal processing lab

81
EINSTEIN COLLEGE OF ENGINEERING Sir.C.V.Raman Nagar, Tirunelveli-12 Department of Electronics and Communication Engineering Subject Code: EC56 Digital Signal Processing Laboratory Name : …………………………………… Reg No : …………………………………… Branch : …………………………………… Year & Semester : ……………………………………

Upload: vallestero-siegfred

Post on 20-Jul-2016

24 views

Category:

Documents


10 download

DESCRIPTION

Digital Signal Processing Lab

TRANSCRIPT

Page 1: EC56 Digital Signal Processing Lab

EINSTEIN COLLEGE OF ENGINEERING Sir.C.V.Raman Nagar, Tirunelveli-12

Department of Electronics and Communication Engineering

Subject Code: EC56

Digital Signal Processing Laboratory

Name : ……………………………………

Reg No : ……………………………………

Branch : ……………………………………

Year & Semester : ……………………………………

Page 2: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 2 of 81

INDEX

S.No

Date

Name of the experiment

Page no

Marks

Signature

1.

2.

3.

4.

5(a).

5(b).

5(c)

5(d)

5(e)

6(a)

6(b)

7.

8.

USING MATLAB

Generation of signals

Convolution of signals

Sampling and effect of aliasing

Calculation of FFT

Design of FIR filter using Kaiser

window

Design of FIR filter using

Rectangular window

Design of FIR filter using

Hamming window

Design of FIR filter using

Hanning window

Design of FIR filter using

Blackmann window

Butterworth digital IIR filter

Chebyshev digital IIR filter

Decimation by Polyphase

Decomposition

Periodogram based Spectral

Estimation

4

8

11

13

15

18

21

24

27

30

33

36

38

Page 3: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 3 of 81

S.No

Date

Name of the experiment

Page no

Marks

Signature

9.

10.

11.

12.

13(a)

13(b)

13(c)

13(d)

USING TMS320C5X

Study of addressing modes

Implementation of Linear and

Circular Convolution

Sampling of signals

Waveform Generation

Design of FIR filter-Low Pass

Filter.

Design of FIR filter-High Pass

Filter

Design of FIR filter-Band Pass

Filter

Design of FIR filter-Band Reject

Filter

40

42

47

49

59

63

67

71

Page 4: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 4 of 81

EX. NO. 1 GENERATION OF SIGNALS Date:

AIM:

To generate the following signals using MATLAB 7.0

1. Unit impulse signal

2. Unit step signal

3. Unit ramp signal

4. Exponential growing signal

5. Exponential decaying signal

6. Sine signal

7. Cosine signal

APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM:

1. Get the number of samples.

2. Generate the unit impulse, unit step using ‘ones’, ‘zeros’ matrix

command.

3. Generate ramp, sine, cosine and exponential signals using corresponding

general formula.

4. Plot the graph.

PROGRAM:

% 1. UNIT IMPULSE SIGNAL clc; clear all; close all; N=input('Number of Samples'); n=-N:1:N x=[zeros(1,N) 1 zeros(1,N)] stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('Impulse Response');

Page 5: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 5 of 81

% 2. UNIT STEP SIGNAL clc; clear all; close all; N=input('Number of Samples = '); n=-N:1:N x=[zeros(1,N) 1 ones(1,N)] stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('Unit Step Response'); % 3. UNIT RAMP SIGNAL clc; clear all; close all; disp('UNUT RAMP SIGNAL'); N=input('Number of Samples = '); a=input('Amplitude = ') n=-N:1:N x=a*n stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('Unit Ramp Response'); % 4. EXPONENTIAL DECAYING SIGNAL clc; clear all; close all; disp('EXPONENTIAL DECAYING SIGNAL'); N=input('Number of Samples = '); a=0.5 n=0:.1:N x=a.^n stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('Exponential Decaying Signal Response'); % 5. EXPONENTIAL GROWING SIGNAL clc; clear all; close all; disp('EXPONENTIAL GROWING SIGNAL');

Page 6: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 6 of 81

N=input('Number of Samples = '); a=0.5 n=0:.1:N x=a.^n stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('Exponential Growing Signal Response');

% 6. COSINE SIGNAL clc; clear all; close all; disp('COSINE SIGNAL'); N=input('Number of Samples = '); n=0:.1:N x=cos(n) stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('Cosine Signal'); % 7. SINE SIGNAL clc; clear all; close all; disp('SINE SIGNAL'); N=input('Number of Samples = '); n=0:.1:N x=sin(n) stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('sine Signal'); OUTPUT:

Page 7: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 7 of 81

RESULT:

Page 8: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 8 of 81

EX.NO. 2 CONVOLUTION OF SIGNALS Date:

AIM: To write the program for finding the linear and circular convolution of two signals using MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0.

LINEAR CONVOLUTION: ALGORITHM:

1. Get the number of samples. 2. Generate the output sequence of the given two input signals using ‘conv’ command. 3. Plot the graph.

PROGRAM: % PROGRAM FOR LINEAR CONVOLUTION clc; clear all; close all; x=input('Enter the first sample'); N1=length(x); h=input('Enter the second sample'); N2=length(h); n=0:1:N1-1; subplot(2,2,1); stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('X Sequence Response'); n=0:1:N2-1; subplot(2,2,2); stem(n,h); xlabel('Time'); ylabel('Amplitude'); title('H Sequence Response');

Page 9: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 9 of 81

y=conv(x,h); N=N1+N2-1; n=0:1:N-1; subplot(2,2,3); stem(n,y); xlabel('Time'); ylabel('Amplitude'); title('Convolution of X&H Response');

CIRCULAR CONVOLUTION: ALGORITHM:

1. Get the number of samples. 2. Generate the sequence for the given two input signals using ‘zeros’ and

‘ones’ matrix command. 3. Generate the convoluted output sequence of the given two input signals

using ‘conv’ command. 4. Plot the graph.

PROGRAM: % PROGRAM FOR CIRCULAR CONVOLUTION clc; clear all; close all; x=input('Enter the first sequence'); N1=length(x); h=input('Enter the second sequence'); N2=length(h); n=0:1:N1-1; subplot(2,2,1); stem(n,x); xlabel('Time'); ylabel('Amplitude'); title('X Sequence Response'); n=0:1:N2-1; subplot(2,2,2); stem(n,h); xlabel('Time'); ylabel('Amplitude'); title('H Sequence Response'); N=max(N1,N2); x=[x,zeros(1,N-N1)]; h=[h,zeros(1,N-N2)]; for n=1:N y(n)=0;

Page 10: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 10 of 81

for i=1:N j=n-i+1; if(j<=0) j=N+j; end y(n)=y(n)+x(i)*h(j); end end disp('Convolution of x & h is'); subplot(2,2,3); stem(y); xlabel('Time'); ylabel('Amplitude'); title('Convolution of X&H Response'); OUTPUT:

RESULT:

Page 11: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 11 of 81

EX.NO. 3 SAMPLING AND EFFECT OF ALIASING Date

AIM: To sample the signal and observe the aliasing effect of that signal using MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM:

1. Get the input frequency and number of samples. 2. The input signal is sampled at the frequencies fs1=2fm, fs2>2fm and

fs3<2fm. 3. Plot the input and sampled signal at various frequencies.

PROGRAM: % PROGRAM FOR SAMPLING AND EFFECT OF ALIASING clc; clear all; close all; N=input('Enter the number of samples N= '); fm=input('Enter the frequency'); t=0:0.01:N; x=cos(2*pi*fm*t); subplot(3,2,1); plot(t,x); % xlabel('Time'); ylabel('Amplitude'); title('Input Signal'); fs1=fm; fs2=2*fm; fs3=5*fm; n=0:0.08:N; y=cos(2*pi*fm*n); subplot(3,2,2); stem(n,y); % xlabel('Time'); ylabel('Amplitude'); title('Sampling Signal'); y1=cos(2*pi*n*fm/fs1); subplot(3,2,3); stem(n,y1);

Page 12: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 12 of 81

% xlabel('Time'); ylabel('Amplitude'); title('Sampling Signal with fs<2fm'); y2=cos(2*pi*n*fm/fs2); subplot(3,2,4); stem(n,y2); xlabel('Time'); ylabel('Amplitude'); title('Sampling Signal with fs=2fm'); y3=cos(2*pi*n*fm/fs3); subplot(3,2,5); stem(n,y3); xlabel('Time'); ylabel('Amplitude'); title('Sampling Signal with fs>2fm'); OUTPUT:

RESULT:

Page 13: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 13 of 81

EX.NO. 4 CALCULATION OF FFT Date:

AIM: To write the program for calculating the N-point FFT and IFFT of given input sequence using MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM:

1. Get the input sequence and its length. 2. Calculate the Fast Fourier Transform and Inverse Fast Fourier Transform

of given sequence using user defined function. 3. Plot the magnitude and phase response of FFT sequence. 4. Plot the IFFT response.

PROGRAM: % CALCULATION OF FFT AND IFFT clc; clear all; close all; x=input('x(n)'); N=length(x); n=input('n'); y=fft(x,n); v=0:1:N-1; t=0:1:n-1; subplot(2,2,1); stem(v,x); xlabel('Time'); ylabel('Amplitude'); title('Input Signal'); subplot(2,2,2); stem(t,abs(y)); xlabel('Time'); ylabel('Amplitude'); title('Magnitude Response'); subplot(2,2,3); stem(t,angle(y)); xlabel('Time'); ylabel('Amplitude');

Page 14: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 14 of 81

title('Phase Response'); disp('fft x(n)=1'); disp(y); y1=ifft(y,n); subplot(2,2,4); stem(t,y1); xlabel('Time'); ylabel('Amplitude'); title('IFFT Response'); disp('ifft X(K)'); disp(y1); OUTPUT:

RESULT:

Page 15: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 15 of 81

EX.NO. 5 (a) DESIGN OF FIR FILTER USING KAISER WINDOW Date:

AIM: To design the FIR filter using Kaiser Window with MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM:

1. Get the pass band and stop band attenuation and frequency. 2. Get the sampling frequency. 3. Find transition width and center frequency (cut-off frequency). 4. Design the low pass, high pass, band pass and band stop filter. 5. Plot the magnitude response of all filters.

PROGRAM: clc; clear all; close all; ap=input('Pass band attenuation='); as=input('Stop band attenuation='); fs=input('Stop band frequency in rad/sec='); fp=input('Pass band frequency in rad/sec='); wsf=input('Sampling frequency in rad/sec='); dw=fs-fp; wc=(fs+fp)/2; wp1=2*fp/wsf; ws1=2*fs/wsf; s1=10^(-0.05*as); e=10^(0.05*ap); s2=(e-1)/(e+1); S=min(s1,s2); A=-20*log10(S); if(A<=21) B=0 elseif(A>21&A<=50) B=0.5842*((A-21)^0.4)+(0.07886*(A-21)); elseif(A>50) B=0.1102*(A-8.7); end N=((wsf*(A-8))/(dw*14.36))+1;

Page 16: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 16 of 81

N=round(N); y=kaiser(N,B); %LOW PASS FILTER x=fir1(N-1,wp1,y); [h,o]=freqz(x,1,256); subplot(2,2,1); plot(o/pi,20*log10(abs(h))); ylabel('Gain in db---->'); xlabel('(a)Normalized frequency---->'); title('LOW PASS FILTER') %HIGH PASS FILTER y1=length(y); t=y(1:y1-1); x=fir1(N-2,wp1,'high',t); [h,o]=freqz(x,1,256); subplot(2,2,2); plot(o/pi,20*log10(abs(h))); ylabel('Gain in db---->'); xlabel('(b)Normalized frequency---->'); title('HIGH PASS FILTER') %BAND PASS FILTER wn=[wp1,ws1]; x=fir1(N-1,wn,y); [h,o]=freqz(x,1,256); subplot(2,2,3); plot(o/pi,20*log10(abs(h))); ylabel('Gain in db---->'); xlabel('(c)Normalized frequency---->'); title('BAND PASS FILTER') %BAND STOP FILTER x=fir1(N-2,wn,'stop',t); [h,o]=freqz(x,1,256); subplot(2,2,4); plot(o/pi,20*log10(abs(h))); ylabel('Gain in db---->'); xlabel('(d)Normalized frequency---->'); title('BAND STOP FILTER')

OUTPUT:

Page 17: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 17 of 81

RESULT:

Page 18: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 18 of 81

EX.NO. 5 (b) DESIGN OF FIR FILTER USING RECTANGULAR WINDOW Date:

AIM: To design a FIR filter using Rectangular window with MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM:

1. Get the pass band and stop band ripple and frequency. 2. Get the sampling frequency. 3. Find the order of filter ‘N’. 4. Design the low pass, high pass, band pass and band stop filter. 5. Plot the magnitude response of all filters.

PROGRAM: clc; clear all; close all; rp=input('Pass band ripple='); rs=input('Stop band ripple='); fs=input('Stop band frequency in rad/sec='); fp=input('Pass band frequency in rad/sec='); f=input('Sampling frequency in rad/sec='); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem) n1=n+1; if(rem(n,2)~=0); n1=n; n=n-1; end y=boxcar(n1); %LOW PASS FILTER b=fir1(n,wp,y); [h,o]=freqz(b,1,256);

Page 19: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 19 of 81

m=20*log10(abs(h)); subplot(2,2,1); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('LOW PASS FILTER') %HIGH PASS FILTER b=fir1(n,wp,'high',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,2); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('HIGH PASS FILTER') %BAND PASS FILTER wn=[wp,ws]; x=fir1(n,wn,y); [h,o]=freqz(b,1,256); subplot(2,2,3); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND PASS FILTER') %BAND STOP FILTER b=fir1(n,wn,'stop',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,4); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND STOP FILTER') OUTPUT:

Page 20: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 20 of 81

RESULT:

Page 21: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 21 of 81

EX.NO. 5 (c) DESIGN OF FIR FILTER USING HAMMING WINDOW Date:

AIM: To design a FIR filter using Hamming window with MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0

ALGORITHM:

1. Get the pass band and stop band ripple and frequency. 2. Get the sampling frequency. 3. Find the order of filter N. 4. Design the lowpass,High pass,Band pass and Band stop filter. 5. Plot the magnitude response of all the filters.

PROGRAM: clc; clear all; close all; rp=input('Pass band ripple='); rs=input('Stop band ripple='); fs=input('Stop band frequency in rad/sec='); fp=input('Pass band frequency in rad/sec='); f=input('Sampling frequency in rad/sec='); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem) n1=n+1; if(rem(n,2)~=0); n1=n; n=n-1; end y=hamming(n1); %LOW PASS FILTER b=fir1(n,wp,y); [h,o]=freqz(b,1,256);

Page 22: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 22 of 81

m=20*log10(abs(h)); subplot(2,2,1); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('LOW PASS FILTER') %HIGH PASS FILTER b=fir1(n,wp,'high',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,2); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('HIGH PASS FILTER') %BAND PASS FILTER wn=[wp,ws]; x=fir1(n,wn,y); [h,o]=freqz(b,1,256); subplot(2,2,3); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND PASS FILTER') %BAND STOP FILTER b=fir1(n,wn,'stop',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,4); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND STOP FILTER') OUTPUT:

Page 23: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 23 of 81

RESULT:

Page 24: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 24 of 81

EX.NO. 5 (d) DESIGN OF FIR FILTER USING HANNING WINDOW Date:

AIM: To design a FIR filter using Hanning window with MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0

ALGORITHM:

1. Get the pass band and stop band ripple and frequency. 2. Get the sampling frequency. 3. Find the order of filter N. 4. Design the lowpass,High pass,Band pass and Band stop filter. 5. Plot the magnitude response of all the filters.

PROGRAM: clc; clear all; close all; rp=input('Pass band ripple='); rs=input('Stop band ripple='); fs=input('Stop band frequency in rad/sec='); fp=input('Pass band frequency in rad/sec='); f=input('Sampling frequency in rad/sec='); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem) n1=n+1; if(rem(n,2)~=0); n1=n; n=n-1; end y=hanning(n1);

Page 25: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 25 of 81

%LOW PASS FILTER b=fir1(n,wp,y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,1); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('LOW PASS FILTER') %HIGH PASS FILTER b=fir1(n,wp,'high',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,2); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('HIGH PASS FILTER') %BAND PASS FILTER wn=[wp,ws]; x=fir1(n,wn,y); [h,o]=freqz(b,1,256); subplot(2,2,3); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND PASS FILTER') %BAND STOP FILTER b=fir1(n,wn,'stop',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,4); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND STOP FILTER')

Page 26: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 26 of 81

OUTPUT: RESULT:

Page 27: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 27 of 81

EX.NO. 5 (e) DESIGN OF FIR FILTER USING BLACKMANN WINDOW Date:

AIM: To design a FIR filter using Blackmann window with MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0

ALGORITHM:

6. Get the pass band and stop band ripple and frequency. 7. Get the sampling frequency. 8. Find the order of filter N. 9. Design the lowpass,High pass,Band pass and Band stop filter. 10. Plot the magnitude response of all the filters.

PROGRAM: clc; clear all; close all; rp=input('Pass band ripple='); rs=input('Stop band ripple='); fs=input('Stop band frequency in rad/sec='); fp=input('Pass band frequency in rad/sec='); f=input('Sampling frequency in rad/sec='); wp=2*fp/f; ws=2*fs/f; num=-20*log10(sqrt(rp*rs))-13; dem=14.6*(fs-fp)/f; n=ceil(num/dem) n1=n+1; if(rem(n,2)~=0); n1=n; n=n-1; end y=blackman(n1);

Page 28: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 28 of 81

%LOW PASS FILTER b=fir1(n,wp,y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,1); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('LOW PASS FILTER') %HIGH PASS FILTER b=fir1(n,wp,'high',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,2); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('HIGH PASS FILTER') %BAND PASS FILTER wn=[wp,ws]; x=fir1(n,wn,y); [h,o]=freqz(b,1,256); subplot(2,2,3); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND PASS FILTER') %BAND STOP FILTER b=fir1(n,wn,'stop',y); [h,o]=freqz(b,1,256); m=20*log10(abs(h)); subplot(2,2,4); plot(o/pi,m,'k'); ylabel('Gain in db---->'); xlabel('Normalized frequency---->'); title('BAND STOP FILTER')

Page 29: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 29 of 81

OUTPUT: RESULT:

Page 30: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 30 of 81

EX.NO. 6 (a) BUTTERWORTH DIGITAL IIR FILTER Date:

AIM: To design a Butterworth digital IIR filter using MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM:

1. Get the pass band and stop band ripples. 2. Get the pass band and stop band frequencies. 3. Get the sampling frequency. 4. Calculate the order of the filter using

log √ [10 kp – 1 / 10 kp – 1] N = ------------------------------------- log s / p

5.Find the filter co-efficient.

6.Draw the magnitude and phase response.

PROGRAM: clear all; clc; close all; format long rp=input(‘enter the pass band ripple’); rs=input(‘enter the stop band ripple’); wp=input(‘enter the pass band frequency ‘); ws=input(‘enter the stop band frequency ‘); fs=input(‘enter the sampling frequency ‘); w1=2*wp/fs; w2=2*ws/fs; %LOW PASS FILTER [n,wn]=buttord(w1,w2,rp,rs]; [b,a]=butter(n,wn); %[b,a]=zp2tf(z,p,k); [b,a]= butter(n,wn);

Page 31: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 31 of 81

W=0:0.01:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); %figure(1); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); %figure(1); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); %HIGH PASS FILTER [n,wn]=buttord(w1,w2,rp,rs]; [b,a]=butter(n,wn,’high’); W=0:0.01:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); figure(2); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); figure(2); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); %BAND PASS FILTER [n]=buttord(w1,w2,rp,rs]; Wn=[w1,w2]; [b,a]=butter(n,wn,’band pass’); W=0:0.01:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); figure(3); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); figure(3); Subplot(2,1,2); Plot(om/pi,an);

Page 32: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 32 of 81

Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); %BAND STOP FILTER [n]=buttord(w1,w2,rp,rs]; Wn=[w1,w2]; [b,a]=butter(n,wn,’band stop’); W=0:0.01:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); figure(4); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); figure(4); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); OUTPUT: RESULT:

Page 33: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 33 of 81

EX.NO. 6 (b) CHEBYSHEV DIGITAL IIR FILTER Date:

AIM: To design a digital IIR filter using Chebyshev filter with MATLAB 7.0. APPARATUS REQUIRED:

System with MATLAB 7.0. ALGORITHM:

1. Get the pass band and stop band ripples. 2. Get the pass band and stop band frequencies. 3. Get the sampling frequency. 4. Calculate the order of the filter using

log √ [10 kp – 1 / 10 kp – 1] N = ------------------------------------- log s / p

5.Find the filter co-efficient.

6.Draw the magnitude and phase response.

PROGRAM: clear all; clc; close all; rp=input(‘enter the pass band ripple’); rs=input(‘enter the stop band ripple’); wp=input(‘enter the pass band frequency ‘); ws=input(‘enter the stop band frequency ‘); fs=input(‘enter the sampling frequency ‘); w1=2*wp/fs; w2=2*ws/fs; %LOW PASS FILTER [n,wn]=cheb ord(w1,w2,rp,rs]; [b,a]=cheby 1(n,wn); W=0:0.01:pi; [h,om]=freqz(b,a,w);

Page 34: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 34 of 81

m=20*log10(abs(h)); an=angle(h); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); %HIGH PASS FILTER [n,wn]= cheb1 ord(w1,w2,rp,rs]; [b,a]=cheby 1(n,rp,wn,’high’); W=0:0.01:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); figure(2); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); figure(2); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); %BAND PASS FILTER [n]=cheb1 ord(w1,w2,rp,rs]; Wn=[w1,w2]; [b,a]=cheby 1(n,rs,wn,’band pass’); W=0:0.01:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); figure(3); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); figure(3); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); %BAND STOP FILTER [n]=cheb 1 ord(w1,w2,rp,rs];

Page 35: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 35 of 81

Wn=[w1,w2]; [b,a]=cheby 1(n,rp,wn,’band stop’); W=0:0.1/pi:pi; [h,om]=freqz(b,a,w); m=20*log10(abs(h)); an=angle(h); figure(4); Subplot(2,1,1); Plot(om/pi,m); Ylabel(‘gain in db…>’); Xlabel(‘(a)normalized frequency…>’); figure(4); Subplot(2,1,2); Plot(om/pi,an); Xlabel(‘(b)normalized frequency…>’); Ylabel(‘phase in radians…>’); OUTPUT: RESULT:

Page 36: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 36 of 81

EX.NO. 7 DECIMATION BY POLYPHASE DECOMPOSITION Date:

AIM: To write a program to compute Convolution and m-fold decimation by polyphase decomposition. APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM: 1. Get the input sequence. 2. Get the filter coefficients and also the decimation factor. 3. Find the response by using convolution. 4. Plot the graph. PROGRAM: %Program for computing convolution and m-fold decimation by polyphase decomposition. clear all; clc; close all; x=input(‘enter the input sequence’); h=input(‘enter the FIR filter coefficients’); M=input(‘enter the decimation factor’); N1=length(x); N=0:1:N1-1; Subplot(2,1,1); Stem(n,x); Xlabel(‘time’); Ylabel(‘amplitude’); Title(‘X sequence response’); N2=length(h); n=0:1:N2-1; Subplot(2,1,2); Stem(n,h); Xlabel(‘time’); Ylabel(‘amplitude’); Title(‘H sequence response’); H=length(h); P=floor((H-1)/M)+1;

Page 37: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 37 of 81

r=reshape([reshape(h,1,H),zeros(1,P*M-H)],M,P); X=length(x); Y=floor((X+H-2)/M)+1; U=floor((X+M-2)/M)+1; R=zeros(1,X+P-1); for m=1:M R=R+conv(x(1,:),r(m,:)); End Disp(R); N=length(R); n=0:1:N-1; figure(2); stem(n,R); xlabel(‘time’); ylabel(‘amplitude’); title(‘Decimation of polyphase decomposition sequence response’); OUTPUT:

Page 38: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 38 of 81

RESULT: EX.NO. 8 PERIODOGRAM BASED SPECTRAL ESTIMATION Date:

AIM: APPARATUS REQUIRED:

System with MATLAB 7.0.

ALGORITHM: PROGRAM:

Page 39: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 39 of 81

OUTPUT: RESULT:

Page 40: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 40 of 81

EX.NO. 9 STUDY OF ADDRESSING MODES Date:

AIM: To study about direct, indirect and immediate addressing modes in TMS320C50 debugger. APPARATUS REQUIRED:

1.System with TMS 320C50 debugger software

2.TMS 320C50 Kit.

ALGORITHM: IMMEDIATE ADDRESSING MODE:

1. Initialize data pointer with 100H data. 2. Load the accumulator with first data. 3. Add the second data with accumulator content. 4. Store the accumulator content in specified address location.

DIRECT ADDRESSING MODE:

1. Initialize data pointer with 100H data. 2. Load the accumulator with first data, whose address is specified in the

instruction. 3. Add the accumulator content with second data, whose address is specified

in the instruction. 4. Store the accumulator content in specified address location.

IN-DIRECT ADDRESSING MODE:

1. Load the auxiliary register with address location of first data. 2. The auxiliary register (AR0) is modified indirectly as # symbol. 3. Load the second data into accumulator and perform addition operation. 4. Store the result.

PROGRAM: ;program for immediate addressing mode .mmregs .text START: LDP #100H

Page 41: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 41 of 81

LACC #1241H ADD #1200H SACL 2H H: B H ;program for direct addressing mode .mmregs .text START: LDP #100H LACC 0H ADD 1H SACL 2H H: B H ;program for adding two numbers with indirect addressing mode. .mmregs .text START: LAR AR0,#8000H MAR *,AR0 LACC *+,0 ;WITH ZERO SHIFT ADD *+ SACL *+ H: B H OUTPUT: RESULT:

Page 42: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 42 of 81

EX.NO.10 IMPLEMENTATION OF LINEAR AND CIRCULAR CONVOLUTION Date:

AIM: To write a program to find the Convolution of two sequences X(n) and H(n) using TMS320C50 debugger. APPARATUS REQUIRED:

1.System with TMS 320C50 debugger software

2.TMS 320C50 Kit.

LINEAR CONVOLUTION

ALGORITHM:

1. Start the program. 2. LPD will load the 9LSB’s of address data memory.

Location or immediate value into the data pointer (DP) register. 3. Load auxiliary register (LAR) loads the content of the address data

memory location into the designated auxilary register. 4. Then ZC clears the content of accumulator too. 5. MAR modify current AR and ARP as specified. 6. The RPT load the 8 bit LSBs of the addressed value of the RPT. 7. The SACL store the 16 LSBs of the accumulator into the addressed data

memory. 8. MUL is used to multiply the content of T register. 9. The LTP would load the contents of the addressed data memory location

into T register. 10. ADD will add the content of the memory. 11. LACC is used to load the content of the addressed data memory into

accumulator.

PROGRAM: ;Program for Linear Convolution .MMREGS .TEXT START: LDP #100H LAR AR1,#(8100H+4H) ZAC

MAR *,AR1

Page 43: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 43 of 81

RPT#2H SACL*+ LAR AR1,#(8200H+4H) ZAC MAR *,AR1 RPT#2H SACL*+ LAR AR3,#(8300H+6H) LAR AR4,#06H

;Multiply & Accumulate: Next_YN: LAR AR1,#8100H LAR AR2,#(8200H+6H) LAR AR0,#06H ZAC SACL 0H MAR *,AR1 LT *+,AR2 Loop_MAC: MPY *-,AR1 LTP *+,AR0 ADD 0H SACL 0H BANZ Loop_MAC,*-,AR2 LACC 0H MAR *,AR3

SACL *- ;Shiftx(n) Values: LAR AR1,#(8100H+6H) LAR AR2,#5H LAR AR0,#2H MAR *,AR1

LACC *- SACL 1H

Shift_XN: LACC *+ SACL *0-,AR2 BANZ Shift_XN,*-,AR1 MAR *+ LACC 1H SACL *,AR4 BANZ Next_YN,*- NOP

Page 44: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 44 of 81

H1: B H1

OUTPUT:

CIRCULAR CONVOLUTION ALGORITHM:

1. Start the Program. 2. Load the LSB’s of the address data memory location. 3. Load the contents of the address data memory location into auxiliary

register. 4. Modify the current AR as specified. 5. Load the content of addressed data memory location. 6. Store the 16 LSBs of the accumulator into the address data memory

location. 7. Load the content in ARL Z.0 8. Branch the contents of entire auxiliary register. 9. Load the content AR.1,AR.2,AR.0 10. Store the content of the accumulator’ 11. Modify the current AR as specified. 12. Stop the program.

PROGRAM:

;Program for Circular Convolution

.MMREGS

.TEXT LDP #100H LACC 0H SUB #1H SACL 1H LAR AR0,1H LAR AR2,#8010H

LOOP3: LAR AR1,#8060H LAR AR3,#8050H LAR AR4,1H ZAP

LOOP:MAR *,AR3

Page 45: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 45 of 81

LT *+,AR1 MPY *+ SPL 5H ADD 5H MAR *,AR4 BANZ LOOP,*-,AR2 SACL *+ CALL ROTATE LOOP2:MAR *,AR0 BANZ LOOP3,*- H: B H ROTATE: LDP #100H LACC 1H SUB #1H SACL 2H LACC 0050H SACB LAR AR3,#8051H LAR AR5,#8070H LAR AR6,2H LOOP1:MAR *,AR3 LACC *+,0,AR5 SACL *+,0,AR6 BANZ LOOP1,*- LACB MAR *,AR5 SACL *+ LACC #8070H SAMM BMAR LAR AR3,#8050H MAR *,AR3 RPT 0H BLDD BMAR,*+ RET OUTPUT:

Page 46: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 46 of 81

RESULT:

Page 47: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 47 of 81

EX.NO. 11 SAMPLING OF SIGNALS Date:

AIM: To write a program to convert analog signals into digital signals using TMS320C50 debugger. APPARATUS REQUIRED:

1.System with TMS 320C50 debugger software

2.TMS 320C50 Kit.

3.CR0

4.Function Generator.

ALGORITHM:

1. Initialize data pointer with 100H data 2. give the analog signal as input 3. Introduce the time delay as per required. 4. Observe the discrete signal as output 5. Plot the graph.

PROGRAM: .mmregs .text LDP #100H START: IN 0,06H NOP IN 0,04H RPT #4FFH NOP OUT 0,04H RPT #4FFH NOP B START MODEL GRAPH:

Page 48: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 48 of 81

OUTPUT:

WAVEFORM AMPLITUDE (V) TIME PERIOD (ms)

INPUT

OUTPUT

RESULT:

Page 49: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 49 of 81

Thus the analog signal was converted into digital signal using TMS320C50 debugger. EX.NO. 12 WAVEFORM GENERATION Date:

AIM: To write a program to generate Triangle Wave,Sine Wave,Square Wave and

SawTooth Wave using TMS320C50 debugger.

APPARATUS REQUIRED:

1.System with TMS 320C50 debugger software

2.TMS 320C50 Kit.

3.CR0

4.Function Generator.

ALGORITHM: TRIANGLE WAVE GENERATION: 1. Start the program. 2. Load the LSBs of the address data memory location. 3. Write full 16 bit pattern into address data memory location. 4. Load the content of address data memory location. 5. Add the content of address data memory location. 6. Store the data of accumulator into address data memory location. 7. Modify the current AR as specified. 8. Repeat the step 2,3. 9. Subtract the contents of address data memory location. 10. Repeat the steps 5,6,7. 11. Stop the program. SINE WAVE GENERATION:

1. Start the program

2. Load the LSBs of the address data memory location

3. Write full 16 bit pattern into address data memory location.

4. Load the content of address data memory location.Specify the address of a

subroutine.

5. Multiply the content of the register.

6. Load the content of the register into accumulator.

7. Store the 16 LSBs of the accumulator into the address data memory

location.

Page 50: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 50 of 81

8. Modify the current AR & ARP as specified. 9. Branch the contents of entire auxiliary register. 10. Load the content of address data memory location.

11. Repeat the Step.

12. Stop the program.

SQUARE WAVE GENERATION:

1. Start the program

2. Load the content of address data memory location.

3. Store the 16 LSBs of the accumulator into the address data memory

location.

4. Load the content of address data memory location.

5. Complement the contents of the accumulator.

6. Stop the program.

SAWTOOTH WAVE GENERATION:

1. Start the program.

2. Load the LSBs of the address data memory location

3. Load the content of address data memory location into

accumulator.

4. Store the 16 LSBs of the accumulator into the address data

memory location

5. Write 16 bit value from from a data memory location to the

specified I/O Port.

6. Add the content of address data memory location.

7. Subtract the content of the register.

8. Branch the program memory address if the specified conditions are

met.

9. Stop the program.

PROGRAM:

;Program for Triangle Wave Generation AMPLITUDE .SET 4

FREQ .SET 350

TEMP .SET 0

Page 51: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 51 of 81

.mmregs

.text

START:LDP #100H

SPLK #0,TEMP

CONT1:LAR AR2,#FREQ

CONT:OUT TEMP ,4

LACC TEMP

ADD #AMPLITUDE

SACL TEMP

MAR *,AR2

BANZ CONT,*-

LAR AR2,#FREQ

CONTx:OUT TEMP,4

LACC TEMP

SUB #AMPLITUDE

SACL TEMP

MAR *,AR2

BANZ CONTx

B CONT1

;Program for Sine Wave Generation

INCFREQ .SET 10 DECFREQ .SET 0 LENGTH .SET 360 AMPLITUDE .SET 5 DELAY1 .SET 7 TEMP .SET 0 TEMP1 .SET 1 .mmregs .text START:LDP #100H SPLK #B500,TEMP LAR AR2,#((LENGTH/INCFREQ)+(LENGTH*DECFREQ))-1 LAR AR3,#DECFREQ CONT:CALL DELAY

LACC TEMP TBLR TEMP1 LT TEMP1 MPY #AMPLITUDE

Page 52: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 52 of 81

PAC SACL TEMP1 MAR *,AR3 BANZ REPEAT,*- LAR AR3,#DECFREQ LACC TEMP ADD #INCFREQ SACL TEMP OUT TEMP1,4 MAR *,AR2 BANZ CONT,*- B START

DELAY:LAR AR7,#DELAY1 MAR *,AR7 BACK:BANZ BACK,*- RET ; TABLE

.word 100 .word 145 .word 101 .word 146 .word 103 .word 148 .word 105 .word 150 .word 106 .word 151 .word 108 .word 152 .word 110 .word 154 .word 112 .word 155 .word 113 .word 157 .word 115 .word 158 .word 117 .word 160 .word 119 .word 161 .word 120 .word 162 .word 122 .word 164 .word 124 .word 165 .word 125 .word 166 .word 127 .word 168

.word 129 .word 169

.word 130 .word 170 .word 132 .word 171 .word 134 .word 173 .word 135 .word 174 .word 137 .word 175 .word 139 .word 176 .word 140 .word 177 .word 142 .word 178 .word 143 .word 179

Page 53: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 53 of 81

.word 180 .word 198 .word 181 .word 198 .word 182 .word 198 .word 183 .word 197 .word 184 .word 197 .word 185 .word 197 .word 186 .word 196

.word 187 .word 196

.word 188 .word 195 .word 189 .word 195 .word 189 .word 194 .word 190 .word 193 .word 191 .word 193 .word 192 .word 192 .word 192 .word 192 .word 193 .word 191 .word 193 .word 190 .word 194 .word 189 .word 195 .word 189 .word 195 .word 188 .word 196 .word 187 .word 196 .word 186 .word 197 .word 185 .word 197 .word 184

.word 197 .word 183

.word 198 .word 182

.word 198 .word 181

.word 198 .word 180

.word 199 .word 179

.word 199 .word 176

.word 199 .word 175

.word 199 .word 174

.word 199 .word 173

.word 199 .word 172

.word 199 .word 171

.word 199 .word 170

.word 200 .word 169

.word 199 .word 168

.word 199 .word 166

.word 199 .word 165

.word 199 .word 164

.word 199 .word 162

.word 199 .word 161

.word 199 .word 160

.word 199 .word 158

Page 54: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 54 of 81

.word 157 .word 99 .word 155 .word 98 .word 154 .word 96 .word 152 .word 94 .word 151 .word 93 .word 149 .word 91

.word 148 .word 89 .word 146 .word 87 .word 145 .word 86

.word 143 .word 84

.word 142 .word 82

.word 140 .word 80

.word 139 .word 79

.word 137 .word 77

.word 135 .word 75

.word 134 .word 74

.word 132 .word 72

.word 130 .word 70

.word 129 .word 69

.word 127 .word 67

.word 125 .word 65

.word 124 .word 64

.word 122 .word 62

.word 120 .word 60

.word 119 .word 59

.word 117 .word 57

.word 115 .word 56

.word 113 .word 54

.word 112 .word 53

.word 110 .word 51

.word 108 .word 49

.word 106 .word 48

.word 105 .word 47

.word 103 .word 45

.word 101 .word 44

Page 55: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 55 of 81

.word 42 .word 6

.word 41 .word 5

.word 39 .word 4

.word 38 .word 4

.word 37 .word 3

.word 35 .word 3 .word 34 .word 2 .word 33 .word 2 .word 31 .word 2

.word 30 .word 1

.word 29 .word 1

.word 28 .word 1

.word 26 .word 0

.word 25 .word 0

.word 24 .word 0

.word 23 .word 0

.word 22 .word 0

.word 21 .word 0

.word 20 .word 0

.word 19 .word 0

.word 18 .word 0

.word 17 .word 0

.word 16 .word 0

.word 15 .word 0

.word 14 .word 0

.word 13 .word 0

.word 12 .word 0

.word 11 .word 0

.word 10 .word 0

.word 10 .word 1

.word 9 .word 1

.word 8 .word 1

.word 7 .word 2

.word 7 .word 2

.word 6 .word 2

Page 56: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 56 of 81

.word 3

.word 3 .word 37

.word 4 .word 38

.word 4 .word 39

.word 5 .word 41

.word 6 .word 42 .word 6 .word 44 .word 7 .word 45 .word 7 .word 47

.word 8 .word 48

.word 9 .word 50

.word 10 .word 53

.word 10 .word 54

.word 11 .word 56

.word 12 .word 57

.word 13 .word 59

.word 14 .word 60

.word 15 .word 62

.word 16 .word 64

.word 17 .word 65

.word 18 .word 67

.word 19 .word 69

.word 20 .word 70

.word 21 .word 72

.word 22 .word 74

.word 23 .word 75

.word 24 .word 77

.word 25 .word 79

.word 26 .word 80

.word 28 .word 82

.word 29 .word 84

.word 30 .word 86

.word 31 .word 87

.word 33 .word 89

.word 34 .word 91 .word 35 .word 93

.word 94

.word 96

.word 98

.word 100

.end

Page 57: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 57 of 81

;Program for Square Wave Generation

.MMREGS .TEXT

START: LDP #100H LACC #0FFFH LOOP: SACL 0 RPT #0FFH

OUT 0,04 CMPL B LOOP END

;Program for SawTooth Wave Generation

.MMREGS

.TEXT START: LDP #120H LACC #0H SACL 0 LOOP: LACC 0

OUT 0,04H ADD #05H SACL 0 SUB #0FFFH BCND LOOP,LEQ B START END

MODEL GRAPH:

Page 58: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 58 of 81

OUTPUT:

WAVEFORM AMPLITUDE (V) TIME PERIOD (ms)

RESULT:

Page 59: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 59 of 81

EX.NO. 13 (a) DESIGN OF FIR FILTER-LOW PASS FILTER Date:

AIM: To design a FIR low pass filter in serial mode. APPARATUS REQUIRED:

1.System with VI debugger software

2.TMS 320C50 Kit.

3.CR0

ALGORITHM:

1. Start the program. 2. Initialize the C table value. 3. Load the auxillary register with 0200H. 4. Modify the auxillary register zero. 5. Block the C table to the program. 6. Set configuration control bit. 7. Load the data pointer with 0AH. 8. Initialize the analog to digital conversion. 9. Load the auxillary register 1 with 0300 content. 10. Load the accumulator in 8000H. 11. AND the accumulator with 0FFFH. 12. Subtract the accumulator content with data 800H. 13. Modify the auxillary register 1. 14. Store the accumulator data in 8000H. 15. Load the auxillary register 1 with content 0333H. 16. Zero the accumulator register. 17. Multiply the accumulator with data. 18. Load the program register, with PM bits to accumulator. 19. Load the auxillary register 1 with content 0300H. 20. Add accumulator content with 800H. 21. Shift the accumulator right 1 bit. 22. Store the accumulator content in 8200 location. 23. Branch the program to step 7.

PROGRAM: *Approximation type:Window design- Blackmann Window *Filter type:Low Pass Filter *Filter Order:52 *Cutoff frequency in KHZ=3.000000

.mmregs .text

Page 60: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 60 of 81

B START CTABLE: .word 0FFE7H .word 0FFD3H .word 0FFC6H .word 0FFC4H .word 0FFD0H .word 0FFECH .word 018H .word 051H .word 08CH .word 0B9H .word 0C2H .word 092H .word 01AH .word 0FF5FH .word 0FE78H .word 0FD9AH .word 0FD10H .word 0FD30H .word 0FE42H .word 071H .word 03B5H .word 07CAH .word 0C34H .word 01054H .word 01387H .word 01547H .word 01547H .word 01387H .word 01054H .word 0C34H .word 07CAH .word 03B5H .word 071H .word 0FE42H .word 0FD30H .word 0FD10H .word 0FD9AH .word 0FE78H .word 0FF5FH .word 01AH .word 092H .word 0C2H .word 0B9H .word 08CH .word 051H .word 018H .word 0FFECH .word 0FFD0H

Page 61: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 61 of 81

.word 0FFC4H .word 0FFC6H .word 0FFD3H .word 0FFE7H * Move the Filter coefficients * from program memory to data memory START: LAR AR0,#0200H MAR *,AR0 RPT #33H BLKP CTABLE,*+ SETC CNF * Input data and perform convolution ISR: LDP #0AH

IN 0,06H IN 0,04H NOP NOP NOP NOP LAR AR1,#0300H

LACC 0 AND #0FFFH SUB #800H

MAR *,AR1 SACL *

LAR AR1,#0333H ZAP RPT #33H MACD 0FF00H,*- APAC LAR AR1,#0300H SACH * ; give as SACH *, 1 in case of overflow LACC * ADD #800H SFR ; remove if output is less amplitude SACL *

OUT *,4 ;pulse to find sampling frequency NOP B ISR .end

Page 62: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 62 of 81

MODEL GRAPH: TABULATION: S.No. Frequency(Hz) Vout(v) Vout/Vin Gain in db=

20log Vout/Vin

RESULT: Thus the program for designing a FIR low pass filter in serial mode was performed

Page 63: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 63 of 81

EX.NO. 13 (b) DESIGN OF FIR FILTER-HIGH PASS FILTER Date:

AIM: To design a FIR high pass filter in serial mode. APPARATUS REQUIRED:

1.System with VI debugger software

2.TMS 320C50 Kit.

3.CR0

ALGORITHM:

1. Start the program. 2. Initialize the C table value. 3. Load the auxillary register with 0200H. 4. Modify the auxillary register zero. 5. Block the C table to the program. 6. Set configuration control bit. 7. Load the data pointer with 0AH. 8. Initialize the analog to digital conversion. 9. Load the auxillary register 1 with 0300 content. 10. Load the accumulator in 8000H. 11. AND the accumulator with 0FFFH. 12. Subtract the accumulator content with data 800H. 13. Modify the auxillary register 1. 14. Store the accumulator data in 8000H. 15. Load the auxillary register 1 with content 0333H. 16. Zero the accumulator register. 17. Multiply the accumulator with data. 18. Load the program register, with PM bits to accumulator. 19. Load the auxillary register 1 with content 0300H. 20. Add accumulator content with 800H. 21. Shift the accumulator right 1 bit. 22. Store the accumulator content in 8200 location. 23. Branch the program to step 7.

PROGRAM: *Approximation type:Window design- Blackmann Window *Filter type:high Pass Filter *Filter Order:52 *Cutoff frequency in KHZ=3.000000

Page 64: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 64 of 81

.mmregs .text B START CTABLE: .word 0FCD3H .word 05H .word 0FCB9H .word 087H .word 0FD3FH .word 01ADH .word 0FE3DH .word 0333H .word 0FF52H .word 04ABH .word 0FFF8H .word 0595H .word 0FFACH .word 0590H .word 0FE11H .word 047CH .word 0FB0BH .word 029DH .word 0F6BAH .word 0AEH .word 0F147H .word 01CH .word 0E9FDH .word 04C5H .word 0D882H .word 044BCH .word 0D882H .word 04C5H .word 0E9FDH .word 01CH .word 0F147H .word 0AEH .word 0F6BAH .word 029DH .word 0FB0BH .word 047CH .word 0FE11H .word 0590H .word 0FFACH .word 0595H .word 0FF8H .word 04ABH .word 0FF52H .word 0333H .word 0FE3DH .word 01ADH

Page 65: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 65 of 81

.word 0FD3FH .word 087H .word 0FCB9H .word 05H .word 0FCD3H * Move the Filter coefficients * from program memory to data memory START: LAR AR0,#0200H MAR *,AR0 RPT #33H BLKP CTABLE,*+ SETC CNF * Input data and perform convolution ISR: LDP #0AH

IN 0,06H IN 0,04H NOP NOP NOP NOP LAR AR1,#0300H

LACC 0 AND #0FFFH SUB #800H

MAR *,AR1 SACL *

LAR AR1,#0333H ZAP RPT #33H MACD 0FF00H,*- APAC LAR AR1,#0300H SACH * ; give as SACH *, 1 in case of overflow LACC * ADD #800H SFR ; remove if output is less amplitude SACL *

OUT *,4 ;pulse to find sampling frequency NOP B ISR .end

Page 66: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 66 of 81

MODEL GRAPH: TABULATION: S.No. Frequency(Hz) Vout(v) Vout/Vin Gain in db=

20log Vout/Vin

RESULT: Thus the program for designing a FIR high pass filter in serial mode was performed.

Page 67: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 67 of 81

EX.NO. 13 (c) DESIGN OF FIR FILTER-BAND PASS FILTER Date:

AIM: To design a FIR band pass filter in serial mode. APPARATUS REQUIRED:

1.System with VI debugger software

2.TMS 320C50 Kit.

3.CR0

ALGORITHM:

1. Start the program. 2. Initialize the C table value. 3. Load the auxillary register with 0200H. 4. Modify the auxillary register zero. 5. Block the C table to the program. 6. Set configuration control bit. 7. Load the data pointer with 0AH. 8. Initialize the analog to digital conversion. 9. Load the auxillary register 1 with 0300 content. 10. Load the accumulator in 8000H. 11. AND the accumulator with 0FFFH. 12. Subtract the accumulator content with data 800H. 13. Modify the auxillary register 1. 14. Store the accumulator data in 8000H. 15. Load the auxillary register 1 with content 0333H. 16. Zero the accumulator register. 17. Multiply the accumulator with data. 18. Load the program register, with PM bits to accumulator. 19. Load the auxillary register 1 with content 0300H. 20. Add accumulator content with 800H. 21. Shift the accumulator right 1 bit. 22. Store the accumulator content in 8200 location. 23. Branch the program to step

PROGRAM: *Approximation type:Window design- Blackmann Window *Filter type:band Pass Filter *Filter Order:52 *lower Cutoff frequency in KHZ=3.000000 *upper Cutoff frequency in KHZ=3.000000

Page 68: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 68 of 81

.mmregs

.text B START CTABLE: .word 024AH .word 010FH .word 0FH .word 0FFECH .word 0C6H .word 0220H .word 0312H .word 02D3H .word 012FH .word 0FEBDH .word 0FC97H .word 0FBCBH .word 0FCB0H .word 0FE9EH .word 029H .word 0FFDCH .word 0FD11H .word 0F884H .word 0F436H .word 0F2A0H .word 0F58AH .word 0FD12H .word 075FH .word 01135H .word 01732H .word 01732H .word 01135H .word 075FH .word 0FD12H .word 0F58AH .word 0F2A0H .word 0F436H .word 0F884H .word 0FD11H .word 0FFDCH .word 029H .word 0FE9EH .word 0FCB0H .word 0FBCBH .word 0FC97H .word 0FEBDH .word 012FH .word 02D3H .word 0312H .word 0220H

Page 69: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 69 of 81

.word 0C6H .word 0FFECH .word 0FH .word 010FH .word 024AH * Move the Filter coefficients * from program memory to data memory START: LAR AR0,#0200H MAR *,AR0 RPT #33H BLKP CTABLE,*+ SETC CNF * Input data and perform convolution ISR: LDP #0AH

IN 0,06H IN 0,04H NOP NOP NOP NOP LAR AR1,#0300H

LACC 0 AND #0FFFH SUB #800H

MAR *,AR1 SACL *

LAR AR1,#0333H ZAP RPT #33H MACD 0FF00H,*- APAC LAR AR1,#0300H SACH * ; give as SACH *, 1 in case of overflow LACC * ADD #800H SFR ; remove if output is less amplitude SACL *

OUT *,4 ;pulse to find sampling frequency NOP B ISR .end

Page 70: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 70 of 81

MODEL GRAPH: TABULATION: S.No. Frequency(Hz) Vout(v) Vout/Vin Gain in db=

20log Vout/Vin

RESULT: Thus the program for designing a FIR band pass filter in serial mode was performed.

Page 71: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 71 of 81

EX.NO. 13 (d) DESIGN OF FIR FILTER-BAND REJECT FILTER Date:

AIM: To design a FIR band reject filter in serial mode. APPARATUS REQUIRED:

1.System with VI debugger software

2.TMS 320C50 Kit.

3.CR0

ALGORITHM:

1. Start the program. 2. Initialize the C table value. 3. Load the auxillary register with 0200H. 4. Modify the auxillary register zero. 5. Block the C table to the program. 6. Set configuration control bit. 7. Load the data pointer with 0AH. 8. Initialize the analog to digital conversion. 9. Load the auxillary register 1 with 0300 content. 10. Load the accumulator in 8000H. 11. AND the accumulator with 0FFFH. 12. Subtract the accumulator content with data 800H. 13. Modify the auxillary register 1. 14. Store the accumulator data in 8000H. 15. Load the auxillary register 1 with content 0333H. 16. Zero the accumulator register. 17. Multiply the accumulator with data. 18. Load the program register, with PM bits to accumulator. 19. Load the auxillary register 1 with content 0300H. 20. Add accumulator content with 800H. 21. Shift the accumulator right 1 bit. 22. Store the accumulator content in 8200 location. 23. Branch the program to step 7.

PROGRAM: *Approximation type:Window design- Blackmann Window *Filter type:band Pass Filter *Filter Order:52 *lower Cutoff frequency in KHZ=3.000000 *upper Cutoff frequency in KHZ=5.000000

Page 72: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 72 of 81

.mmregs .text B START CTABLE: .word 0FEB9H .word 014EH .word 0FDA1H .word 155H .word 0FE1BH .word 282H .word 0FEAFH .word 2ACH .word 0FD35H .word 8DH .word 0F9D9H .word 0FE07H .word 0F7CCH .word 0FEE2H .word 0FA2FH .word 4BAH .word 1AH .word 25CH .word 420H .word 1008H .word 89H .word 0D61H .word 0F3F2H .word 0AF9H .word 0DB7EH .word 045DFH .word 0DB7EH .word 0AF9H .word 0F3F2H .word 0D61H .word 81H .word 89H .word 1008H .word 420H .word 25CH .word 1AH .word 4BAH .word 0FA2FH .word 0FEE2H .word 0F7CCH .word 0FE07H .word 0F9D9H .word 8DH .word 0FD35H .word 2ACH .word 0FEAFH

Page 73: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 73 of 81

.word 282H .word 0FE1BH .word 155H .word 0FDA1H .word 14EH .word 0FEB9H * Move the Filter coefficients * from program memory to data memory START: LAR AR0,#0200H MAR *,AR0 RPT #33H BLKP CTABLE,*+ SETC CNF * Input data and perform convolution ISR: LDP #0AH

IN 0,06H IN 0,04H NOP NOP NOP NOP LAR AR1,#0300H

LACC 0 AND #0FFFH SUB #800H

MAR *,AR1 SACL *

LAR AR1,#0333H ZAP RPT #33H MACD 0FF00H,*- APAC LAR AR1,#0300H SACH * ; give as SACH *, 1 in case of overflow LACC * ADD #800H SFR ; remove if output is less amplitude SACL *

OUT *,4 ;pulse to find sampling frequency NOP B ISR .end

Page 74: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 74 of 81

MODEL GRAPH: TABULATION: S.No. Frequency(Hz) Vout(v) Vout/Vin Gain in db=

20log Vout/Vin

RESULT: Thus the program for designing a FIR band reject filter in serial mode was performed using TMS320C50 debugger.

Page 75: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 75 of 81

Viva questions: 1.What is a continous and discrete time signal?

2.Give the classification of signals.

3.What are the types of system?

4.What are even and odd signal?

5.What are energy and power signal?

6.What are elementary signals and name them?

Page 76: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 76 of 81

7.What is time invariant system?

8.What do you mean by periodic and aperiodic signals?

9.Determine the convolution sum of two sequences x(n) = {3, 2, 1, 2} and h(n) = {1, 2, 1, 2} 10.Find the convolution of the signals x(n) = 1 n=-2,0,1 = 2 n=-1 = 0 elsewhere. 11. Differentiate DTFT and DFT. 12..Differentiate between DIT and DIF algorithm

Page 77: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 77 of 81

13.How many stages are there for 8 point DFT 14. How many multiplication terms are required for doing DFT by expressionalmethod and FFT method 15.Distinguish IIR and FIR filters 16.Write the expression for order State the steps to design digital IIR filter using bilinear method of Butterworth filter? 17.Write the expression for the order of chebyshev filter? 18.What is warping effect? 19.Write a note on pre warping. 20.What is meant by impulse invariant method?

Page 78: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 78 of 81

21. Give the Butterworth filter transfer function and its magnitude characteristics for different orders of filter. 22. Give the magnitude function of Butterworth filter. 23. How can you design a digital filter from analog filter? 24.write down bilinear transformation. 25.What is filter?

26. What are the types of digital filter according to their impulse response? 27.what is mean by FIR filter? 28.Write the steps involved in FIR filter design. 29.List the well known design technique for linear phase FIR filter design? 30.Define IIR filter?

Page 79: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 79 of 81

31.What is the reason that FIR filter is always stable? 32.What are the properties of FIR filter? 33.What is the principle of designing FIR filter using frequency sampling method? 34.What is meant by autocorrelation? 35.Define white noise? 36.List out the addressing modes supported by C5X processors? 37.What do you understand by input quantization error? 38.List the on-chip peripherals in 5X.

Page 80: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 80 of 81

39.what is meant rounding? 40.what is meant by A/D conversion noise? 41.what is meant by quantization step size? 42.what is overflow oscillation? 43.what are the methods used to prevent overflow? 44.what are the two kinds of limit cycle behavior in DSP? 45.What is meant by "dead band" of the filter?

Page 81: EC56 Digital Signal Processing Lab

EC 56-Digital Signal Processing Lab

©Einstein College of Engineering

Page 81 of 81