You are on page 1of 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

: : : :

EC 56-Digital Signal Processing Lab

INDEX

S.No

Date

Name of the experiment

Page no

Marks

Signature

USING MATLAB 1. 2. 3. 4. 5(a). Generation of signals Convolution of signals Sampling and effect of aliasing Calculation of FFT Design of FIR filter using Kaiser window 5(b). Design of FIR filter using Rectangular window 5(c) Design of FIR filter using Hamming window 5(d) Design of FIR filter using Hanning window 5(e) Design of FIR filter using Blackmann window 6(a) 6(b) 7. Butterworth digital IIR filter Chebyshev digital IIR filter Decimation by Polyphase Decomposition 8. Periodogram based Spectral Estimation 38 30 33 36 27 24 21 18 4 8 11 13 15

Einstein College of Engineering Page 2 of 81

EC 56-Digital Signal Processing Lab

S.No

Date

Name of the experiment

Page no

Marks

Signature

USING TMS320C5X 9. 10. Study of addressing modes Implementation of Linear and Circular Convolution 11. 12. 13(a) Sampling of signals Waveform Generation Design of FIR filter-Low Pass Filter. 13(b) Design of FIR filter-High Pass Filter 13(c) Design of FIR filter-Band Pass Filter 13(d) Design of FIR filter-Band Reject Filter 71 67 63 47 49 59 40 42

Einstein College of Engineering Page 3 of 81

EC 56-Digital Signal Processing Lab

EX. NO. 1 Date: AIM:

GENERATION OF SIGNALS

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');

Einstein College of Engineering Page 4 of 81

EC 56-Digital Signal Processing Lab

% 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'); Einstein College of Engineering Page 5 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 6 of 81

EC 56-Digital Signal Processing Lab

RESULT:

Einstein College of Engineering Page 7 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 2 Date: AIM:

CONVOLUTION OF SIGNALS

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'); Einstein College of Engineering Page 8 of 81

EC 56-Digital Signal Processing Lab 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; Einstein College of Engineering Page 9 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 10 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 3 Date AIM:

SAMPLING AND EFFECT OF ALIASING

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); Einstein College of Engineering Page 11 of 81

EC 56-Digital Signal Processing Lab % 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:

Einstein College of Engineering Page 12 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 4 Date: AIM:

CALCULATION OF FFT

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'); Einstein College of Engineering Page 13 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 14 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 5 (a) Date: AIM:

DESIGN OF FIR FILTER USING KAISER WINDOW

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

ALGORITHM: 1. 2. 3. 4. 5. Get the pass band and stop band attenuation and frequency. Get the sampling frequency. Find transition width and center frequency (cut-off frequency). Design the low pass, high pass, band pass and band stop filter. 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; Einstein College of Engineering Page 15 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 16 of 81

EC 56-Digital Signal Processing Lab

RESULT:

Einstein College of Engineering Page 17 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 5 (b) Date: AIM:

DESIGN OF FIR FILTER USING RECTANGULAR WINDOW

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

ALGORITHM: 1. 2. 3. 4. 5. Get the pass band and stop band ripple and frequency. Get the sampling frequency. Find the order of filter N. Design the low pass, high pass, band pass and band stop filter. 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); Einstein College of Engineering Page 18 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 19 of 81

EC 56-Digital Signal Processing Lab

RESULT:

Einstein College of Engineering Page 20 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 5 (c) Date: AIM:

DESIGN OF FIR FILTER USING HAMMING WINDOW

To design a FIR filter using Hamming window with MATLAB 7.0. APPARATUS REQUIRED: System with MATLAB 7.0 ALGORITHM: 1. 2. 3. 4. 5. Get the pass band and stop band ripple and frequency. Get the sampling frequency. Find the order of filter N. Design the lowpass,High pass,Band pass and Band stop filter. 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); Einstein College of Engineering Page 21 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 22 of 81

EC 56-Digital Signal Processing Lab

RESULT:

Einstein College of Engineering Page 23 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 5 (d) Date: AIM:

DESIGN OF FIR FILTER USING HANNING WINDOW

To design a FIR filter using Hanning window with MATLAB 7.0. APPARATUS REQUIRED: System with MATLAB 7.0 ALGORITHM: 1. 2. 3. 4. 5. Get the pass band and stop band ripple and frequency. Get the sampling frequency. Find the order of filter N. Design the lowpass,High pass,Band pass and Band stop filter. 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);

Einstein College of Engineering Page 24 of 81

EC 56-Digital Signal Processing Lab

%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')

Einstein College of Engineering Page 25 of 81

EC 56-Digital Signal Processing Lab

OUTPUT:

RESULT:

Einstein College of Engineering Page 26 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 5 (e) Date: AIM:

DESIGN OF FIR FILTER USING BLACKMANN WINDOW

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);

Einstein College of Engineering Page 27 of 81

EC 56-Digital Signal Processing Lab

%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')

Einstein College of Engineering Page 28 of 81

EC 56-Digital Signal Processing Lab

OUTPUT:

RESULT:

Einstein College of Engineering Page 29 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 6 (a) Date: AIM:

BUTTERWORTH DIGITAL IIR FILTER

To design a Butterworth digital IIR filter using MATLAB 7.0. APPARATUS REQUIRED: System with MATLAB 7.0. ALGORITHM: 1. 2. 3. 4. Get the pass band and stop band ripples. Get the pass band and stop band frequencies. Get the sampling frequency. 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); Einstein College of Engineering Page 30 of 81

EC 56-Digital Signal Processing Lab 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); Einstein College of Engineering Page 31 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 32 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 6 (b) Date: AIM:

CHEBYSHEV DIGITAL IIR FILTER

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

ALGORITHM: 1. 2. 3. 4. Get the pass band and stop band ripples. Get the pass band and stop band frequencies. Get the sampling frequency. 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); Einstein College of Engineering Page 33 of 81

EC 56-Digital Signal Processing Lab 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]; Einstein College of Engineering Page 34 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 35 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 7 Date: AIM:

DECIMATION BY POLYPHASE DECOMPOSITION

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; Einstein College of Engineering Page 36 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 37 of 81

EC 56-Digital Signal Processing Lab RESULT:

EX.NO. 8 Date: AIM:

PERIODOGRAM BASED SPECTRAL ESTIMATION

APPARATUS REQUIRED: System with MATLAB 7.0. ALGORITHM:

PROGRAM:

Einstein College of Engineering Page 38 of 81

EC 56-Digital Signal Processing Lab

OUTPUT:

RESULT:

Einstein College of Engineering Page 39 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 9 Date: AIM:

STUDY OF ADDRESSING MODES

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. 2. 3. 4. Initialize data pointer with 100H data. Load the accumulator with first data. Add the second data with accumulator content. 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 Einstein College of Engineering Page 40 of 81

EC 56-Digital Signal Processing Lab LACC #1241H ADD #1200H SACL 2H BH

H:

;program for direct addressing mode .mmregs .text START: LDP #100H LACC 0H ADD 1H SACL 2H BH

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: BH

OUTPUT:

RESULT:

Einstein College of Engineering Page 41 of 81

EC 56-Digital Signal Processing Lab

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 9LSBs 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 Einstein College of Engineering Page 42 of 81

EC 56-Digital Signal Processing Lab 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 Einstein College of Engineering Page 43 of 81

EC 56-Digital Signal Processing Lab H1: B H1

OUTPUT:

CIRCULAR CONVOLUTION ALGORITHM: 1. Start the Program. 2. Load the LSBs 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 Einstein College of Engineering Page 44 of 81

EC 56-Digital Signal Processing Lab 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:

Einstein College of Engineering Page 45 of 81

EC 56-Digital Signal Processing Lab

RESULT:

Einstein College of Engineering Page 46 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 11 Date: AIM:

SAMPLING OF SIGNALS

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. 2. 3. 4. 5. Initialize data pointer with 100H data give the analog signal as input Introduce the time delay as per required. Observe the discrete signal as output 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:

Einstein College of Engineering Page 47 of 81

EC 56-Digital Signal Processing Lab

OUTPUT: WAVEFORM AMPLITUDE (V) TIME PERIOD (ms)

INPUT

OUTPUT

RESULT:

Einstein College of Engineering Page 48 of 81

EC 56-Digital Signal Processing Lab 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. Einstein College of Engineering Page 49 of 81

EC 56-Digital Signal Processing Lab 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 Einstein College of Engineering Page 50 of 81

EC 56-Digital Signal Processing Lab .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 Einstein College of Engineering Page 51 of 81

EC 56-Digital Signal Processing Lab 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 .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word 100 101 103 105 106 108 110 112 113 115 117 119 120 122 124 125 127 129 130 132 134 135 137 139 140 142 143 .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word 145 146 148 150 151 152 154 155 157 158 160 161 162 164 165 166 168 169 170 171 173 174 175 176 177 178 179

Einstein College of Engineering Page 52 of 81

EC 56-Digital Signal Processing Lab

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

180 181 182 183 184 185 186 187 188 189 189 190 191 192 192 193 193 194 195 195 196 196 197 197 197 198 198 198 199 199 199 199 199 199 199 199 200 199 199 199 199 199 199 199 199

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

198 198 198 197 197 197 196 196 195 195 194 193 193 192 192 191 190 189 189 188 187 186 185 184 183 182 181 180 179 176 175 174 173 172 171 170 169 168 166 165 164 162 161 160 158

Einstein College of Engineering Page 53 of 81

EC 56-Digital Signal Processing Lab

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

157 155 154 152 151 149 148 146 145 143 142 140 139 137 135 134 132 130 129 127 125 124 122 120 119 117 115 113 112 110 108 106 105 103 101

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

99 98 96 94 93 91 89 87 86 84 82 80 79 77 75 74 72 70 69 67 65 64 62 60 59 57 56 54 53 51 49 48 47 45 44

Einstein College of Engineering Page 54 of 81

EC 56-Digital Signal Processing Lab

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

42 41 39 38 37 35 34 33 31 30 29 28 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 10 9 8 7 7 6

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

6 5 4 4 3 3 2 2 2 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 2 2 2

Einstein College of Engineering Page 55 of 81

EC 56-Digital Signal Processing Lab

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word

3 3 4 4 5 6 6 7 7 8 9 10 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28 29 30 31 33 34 35

.word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .end

37 38 39 41 42 44 45 47 48 50 53 54 56 57 59 60 62 64 65 67 69 70 72 74 75 77 79 80 82 84 86 87 89 91 93 94 96 98 100

Einstein College of Engineering Page 56 of 81

EC 56-Digital Signal Processing Lab

;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:

Einstein College of Engineering Page 57 of 81

EC 56-Digital Signal Processing Lab

OUTPUT: WAVEFORM AMPLITUDE (V) TIME PERIOD (ms)

RESULT:

Einstein College of Engineering Page 58 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 13 (a) Date: AIM:

DESIGN OF FIR FILTER-LOW PASS FILTER

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 Einstein College of Engineering Page 59 of 81

EC 56-Digital Signal Processing Lab 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 Einstein College of Engineering Page 60 of 81

EC 56-Digital Signal Processing Lab .word 0FFC4H .word 0FFC6H .word 0FFD3H .word 0FFE7H Move the Filter coefficients from program memory to data memory

* *

START: LAR MAR RPT BLKP SETC

AR0,#0200H *,AR0 #33H CTABLE,*+ 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

Einstein College of Engineering Page 61 of 81

EC 56-Digital Signal Processing Lab

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

Einstein College of Engineering Page 62 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 13 (b) Date: AIM:

DESIGN OF FIR FILTER-HIGH PASS FILTER

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 Einstein College of Engineering Page 63 of 81

EC 56-Digital Signal Processing Lab .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 Einstein College of Engineering Page 64 of 81

EC 56-Digital Signal Processing Lab .word 0FD3FH .word 087H .word 0FCB9H .word 05H .word 0FCD3H * Move the Filter coefficients from program memory to data memory

START: LAR MAR RPT BLKP SETC

AR0,#0200H *,AR0 #33H CTABLE,*+ 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

Einstein College of Engineering Page 65 of 81

EC 56-Digital Signal Processing Lab

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.

Einstein College of Engineering Page 66 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 13 (c) Date: AIM:

DESIGN OF FIR FILTER-BAND PASS FILTER

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 Einstein College of Engineering Page 67 of 81

EC 56-Digital Signal Processing Lab

.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 Einstein College of Engineering Page 68 of 81

EC 56-Digital Signal Processing Lab .word .word .word .word .word 0C6H 0FFECH 0FH 010FH 024AH

* Move the Filter coefficients from program memory to data memory

START: LAR MAR RPT BLKP SETC

AR0,#0200H *,AR0 #33H CTABLE,*+ 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

Einstein College of Engineering Page 69 of 81

EC 56-Digital Signal Processing Lab

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.

Einstein College of Engineering Page 70 of 81

EC 56-Digital Signal Processing Lab

EX.NO. 13 (d) Date: AIM:

DESIGN OF FIR FILTER-BAND REJECT FILTER

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

Einstein College of Engineering Page 71 of 81

EC 56-Digital Signal Processing Lab .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 Einstein College of Engineering Page 72 of 81

EC 56-Digital Signal Processing Lab .word .word .word .word .word .word 282H 0FE1BH 155H 0FDA1H 14EH 0FEB9H

* Move the Filter coefficients from program memory to data memory

START: LAR MAR RPT BLKP SETC

AR0,#0200H *,AR0 #33H CTABLE,*+ 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

Einstein College of Engineering Page 73 of 81

EC 56-Digital Signal Processing Lab 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.

Einstein College of Engineering Page 74 of 81

EC 56-Digital Signal Processing Lab

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?

Einstein College of Engineering Page 75 of 81

EC 56-Digital Signal Processing Lab

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

Einstein College of Engineering Page 76 of 81

EC 56-Digital Signal Processing Lab

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?

Einstein College of Engineering Page 77 of 81

EC 56-Digital Signal Processing Lab 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? Einstein College of Engineering Page 78 of 81

EC 56-Digital Signal Processing Lab

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.

Einstein College of Engineering Page 79 of 81

EC 56-Digital Signal Processing Lab

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?

Einstein College of Engineering Page 80 of 81

EC 56-Digital Signal Processing Lab

Einstein College of Engineering Page 81 of 81

You might also like