22
G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication Engineering Branch:-7 th Semester[Electronics] Subject:-Digital Signal Processing List of Experiments CYCLE-I 1. Write a MATLAB program to generate standard discrete time signals and to plot them. 2. Write a MATLAB program to evaluate the convolution between two given sequences. 3. Write a MATLAB program to find the poles, zeros and express H[z] in factored form. H[z] = (z 4 + 8z 3 + 20z 2 + 25z +16)/(z 4 + 2z 3 -8z 2 +12z-10) 4. (a) Write a MATLAB program to evaluate the impulse response of following difference equation. y[n] – 0.25y[n-1]+0.45y[n-2] = 1.55x[n] + 1.95x[n-1]+2.15x[n-2] (b) To study the block diagrammatic representation of FIR systems using DF-I and DF-II forms. 5. Write a MATLAB program to evaluate linear convolution using DFT for two finite sequences. Also compute errors between convolution by DFT and direct linear convolution. CYCLE-II 5. Write am MATLAB program to to obtain original sequence x[n] by IDFT for given k point DFT. X[k] = k/K 0 k K-1 0 elsewhere 7. Write a MATLAB program to design a FIR low pass filter with following specification using Keiser Window. M = 61, = 4.95 , 0.35 (actully0.35 ). 8. To implement convolution on fixed point DSP processor 9. To study the effects of low pass filter on floating point DSP processor 10. To study the effects of high pass filter on floating point DSP processor

G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Embed Size (px)

Citation preview

Page 1: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication Engineering

Branch:-7th Semester[Electronics] Subject:-Digital Signal Processing

List of Experiments

CYCLE-I

1. Write a MATLAB program to generate standard discrete time signals and to plot them.

2. Write a MATLAB program to evaluate the convolution between two given

sequences.

3. Write a MATLAB program to find the poles, zeros and express H[z] in factored form. H[z] = (z4 + 8z3 + 20z2 + 25z +16)/(z4+ 2z3-8z 2+12z-10)

4. (a) Write a MATLAB program to evaluate the impulse response of following

difference equation. y[n] – 0.25y[n-1]+0.45y[n-2] = 1.55x[n] + 1.95x[n-1]+2.15x[n-2] (b) To study the block diagrammatic representation of FIR systems using DF-I and DF-II forms.

5. Write a MATLAB program to evaluate linear convolution using DFT for two finite sequences. Also compute errors between convolution by DFT and direct linear convolution.

CYCLE-II

5. Write am MATLAB program to to obtain original sequence x[n] by IDFT for given k point DFT.

X[k] = k/K 0 � k � K-1 0 elsewhere 7. Write a MATLAB program to design a FIR low pass filter with following

specification using Keiser Window. M = 61,� = 4.95 , ����0.35 (actully0.35 �). 8. To implement convolution on fixed point DSP processor 9. To study the effects of low pass filter on floating point DSP processor 10. To study the effects of high pass filter on floating point DSP processor

Page 2: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment No:-1

Aim:- Write a MATLAB program to generate standard discrete time signals & plot them Problem:-To generate the following waveforms:- a) Unit impulse Function b) Unit step Function c) Ramp Function d) Delayed unit impulse Function e) Delayed unit step Function f) Sinusoidal Function Theory:-

A discrete signal is a signal defined only for integer values of the independent variable(s). Several representations, including explicit sequences of values, formulas, and piecewise formulas are available for use in Signals and Systems. Digital signals are thus a subset of discrete signals, and both are handled identically by Signals and Systems. The second-most important discrete-time signal is the unit sample, which is defined to be �(n) = 1 if n=0 0 otherwise Discrete-time systems can act on discrete-time signals in ways similar to those found in analog signals and systems. In fact, a special class of analog signals can be converted into discrete-time signals, processed with software, and converted back into an analog signal, all without the incursion of error.

A discrete-time signal is represented symbolically as s(n), where n={…,-1,0,1,…}. We usually draw discrete-time signals as stem plots to emphasize the fact they are functions defined only on the integers.

We can delay a discrete-time signal by an integer just as with analog ones. A delayed unit sample has the expression �(n−m), and equals one when n=m.

The unit step function is equal to zero when its index is negative and equal to one for non-negative indexes unit step: u(n) = 1 if n=0 0 otherwise Program:-

Page 3: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Simulation Results:-

Viva questions:- 1. What is the difference between discrete and digital signal? 2. Define a system and a signal. 3. What is the impulse response of the system?

Page 4: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment No:-2 Aim:- Write a MATLAB program to evaluate the convolution between two sequences. Problem:- The given sequences are

1) x1(n) = { 1 ,2 ,3 ,4 } 2) x1(n) = { 3 ,6 ,1 ,1 }

Theory:- Convolution is used in DSP to find the system response of Linear Time-Invariant [LTI] systems, to arbitrary inputs.

As with signals, convolution exists in both discrete-time and continuous time domains. The focus of this document is simply on convolution in the discrete time domain. Assume a system with

1. Impulse response of h[n] 2. Input forcing signal x[n] 3. Output response y[n]

We symbolically write the system response of the convolution of two sequences as

y[n]= x[n]*h[n]. This is equivalent to

y[n]= [0,N-1] (x[k] X h[n-k]), where n varies from 0,1,2,3..N-1. If we have the following sequences :-

1. Impulse response of h[n] of length N 2. Input forcing signal x[n] of length M 3. And are required to find out the value of the output system response y[n]. 4. You are supposed to use the convolution of x[n] and h[n] to get y[n]. 5. y[n]= convolution(x[n],h[n]) = x[n]*y[n] 6. y[n] is of length M+N-1

Program:-

Page 5: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Simulation Results:-

Viva questions:-

1. What is convolution? And what are the methods of convolution. 2. Quote any Two applications of convolution.

Page 6: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment No.3

Aim: Write a MATLAB program to find the poles, zeros of given system. Problem: find the poles, zeros of given systems.

H [z] = 1/(Z-1)

H[z] = Z/(Z-2)2

H[z] = Z/(Z2-Z-1)

H[z] = (Z+2)/ (Z2-Z-1) (Z-2)

Theory: The general system function is

10

10

( )1

M

kkN

kk

b ZH z

a Z

−=

−=

=+�

Poles: The poles of the systems are values of variable Z for which system function H(z) becomes infinite. Zeros: The Zeros of the systems are values of variable Z for which system function H(z) becomes zero. Program:-

Page 7: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Simulation result:-

-1 -0.5 0 0.5 1-1

-0.5

0

0.5

1

Real Part

Imaginary Part

pole zero plot 1

-1 0 1 2

-1

-0.5

0

0.5

1

2

Real Part

Imaginary Part

pole zero plot 2

-1 -0.5 0 0.5 1-1

-0.5

0

0.5

1

Real Part

Imaginary Part

pole zero plot 3

-2 -1 0 1 2

-1

0

1

Real Part

Imaginary Part

pole zero plot 4

Discussion questions:- Q1. What are Poles? Q2. What are Zeroes? Q3. What is the necessity to study Pole-Zero plot of any systems.? Q4. Where should poles lies in pole-zero plot for a stable system? Q5. What is difference between Pole-zero plot of Laplas Transform & in Z-Transform?

Page 8: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment No:-4

Aim:- (a)Write a MATLAB program to evaluate the impulse response of the system (b)To study block diagrammatic representation of FIR system using DF- I & DF-II System. Problem:-

The Difference equation is given as- y[n]-0.25y[n-1]+0.45y[n-2]=1.55x[n]+1.95x[n-1]+ 2.15x[n]

Theory:-

LTI Discrete time system is completely specified by its impulse response i.e. knowing the impulse response we can compute the output of the system to any arbitrary input. Let h[n] denotes the impulse response of the LTI discrete time systems. Since discrete time system is time invariant, its response to �[n-1] will be h[n-1] .Likewise the response to �[n+2] , �[n-4] and �[n-6] will be h[n+2], h[n-4] and h[n-6] . From the above result arbitrary input sequence x[n] can be expressed as a weighted linear combination of delayed and advanced unit sample in the form k=+� X[n] = � x[k] � [n-k] k=-� where weight x[k] on the right hand side denotes specifically the k th sample value of the sequence. The response of the LTI discrete time system to the sequence x[k] � [n-k] will be x[k] h [n-k]. As a result, the response y[n] of the discrete time system to x[n] will be given by k=+� y[n] = � x[k] h [n-k] …………..(1) k=-� Which can be alternately written as k=+� y[n] = � x[n-k] h [k]…………(2) k=-� The above equation (1) and (2) is called the convolution sum of the sequences x[n] and h[n] and represented compactly as y[n]=x[n] * h[n] Where the notation * denotes the convolution sum. Structure for Realization of Linear Time Invariant systems:

Let us consider the first order system Y(n)=-a 1y(n-1)+b0 x(n) +b1 x(n-1) This realization uses separate delays(memory) for both the input and output samples and it is called as Direct form one structure. A close approximation reveals that the two delay elements contain the same input w(n) and hence the same output w(n-1).consequently these two elements can be merged into one delay. In contrast to the direct form I structure , this new realization requires only one delay for auxiliary quantity w(n) ,and it is more efficient in terms of memory requirements. It is called the direct form II structure and it is used extensively.

Page 9: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Program:- Simulation result:-

Discussion questions:-

1) Differentiate between linear and circular convolution. 2) Determine the unit step response of the linear time invariant system with impulse

response h(n)=a n u(n) a<1 & -a<1 3) Determine the range of values of the parameter a for which linear time invariant

system with impulse response h(n)=a n u(n) is stable. 4) Consider the special case of a finite duration sequence given as

X(n)={2 4 0 3}, resolve the sequence x(n) into a sum of weighted sequences.

Page 10: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment no 5:- Aim:- Write a program to evaluate the convolution using DFT for two finite sequences Also compute error between convolution by DFT and direct linear convolution Problem:- The sequences are given as x1(n) = {1 ,2 ,3,4} x2(n)={1, 1, 1,1} Theory:- Discrete Convolution Convolution, as just described using integrals

Steps Involved in Convolution 1) Time reverse the sequence

h[k] arriving at h[-k] 2) Shift h[-k] to the right by n sampling periods if n> 0 ,or to the left by n sampling period to form the sequence h[n-k] . 3) Product sequence:

v [k] = x[k] .h[n-k] 4) Summing all samples of v [k] then yields the nth sample y[n] of the 5) The process is implemented for each value of n in the range -�<n<+�. 6) The computation of output sequence is simply arithmetic operation such as addition , multiplication and delays. 7) In case of discrete time system with an infinite length sequence, the output sequence is also of infinite length. Program:-

Page 11: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Simulation result:-

Discussion questions:-

1) Differentiate between time variant and time invariant system. 2) If x 1(n)={1,2,3,4} and x 2(n)={1,2,3}

Find the convolution using tabular representation. 3) Draw all elementary standard discrete time signals. 4) Differentiate between causal and Non causal system. 5) If x 1(n)={1,2,3,4} and x 2(n)={5,6,7,8} Find the circular representation for the above sequences.

Page 12: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment no. :-6 Aim:- Write a MATLAB program to obtain original sequence x[n] by IDFT for given k point DFT. X[K]= k/K 0<=k<=K-1 0 elsewhere Problem:- Find the original sequence x[n] if DFT is X[K]= X{2,1+j,0,1-j} Theory:- For the analysis of discrete time sequence normally we convert it from time domain to frequency domain sequence X(w). but X(w) is a continuous function of frequency and therefore not convenient for computing using DSP processor. So, in order to make X(w) ,we sample it. The fourier transform we get is discrete in nature and is called Discrete Fourier Transform. If time domain sequence is denoted by x[n], its fourier transform by X(W), then sampled version of X(W)is DFT of x[n]. DFT can be defined as , a finite duration sequence that is obtained by sampling one time period of FT. Sampling is done at N equally spaced points over the period extending from 0<=w<=2Π.

X[K]= � x[n] e-j2Πnk/N

Mathematically, inverse DFT i.e. IDFT is given as, x[n] = 1/N{ � X[K] ej2Πnk/N}

The above two equations are called DFT pair. The term e-j2Π/N is called Twiddle factor WN

Program:-

X1[n] Length= L

X2[n] Length= M

C2= L-1 Zero padding

C2 = L-1 Ze C2= L-1

Zero padding

C2 = L-1 Zero padding

X2zp[n]

C1 = M-1 Zero padding

X1zp[n]

C point IDFT Z[n]

Linear Convolution

C2= L-1 Zero padding

C2= L-1 Zero padding

Page 13: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Simulation result:-

Discussion questions:-

1. Prove the linearity property of DFT. 2. Explain the concept of circular shift.

Page 14: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment no.:- 7

Aim:- Write a MATLAB program to design a FIR low pass filter Problem:- Design a FIR low pass filter using Kaiser window for the following parameters.:- M= 61, Beta= 4.95, Wc =0.35(Actually 0.35pi) Theory:- In practice all the signals are mixed up with unwanted signals To remove, or to reduce the strength of these unwanted signal and to improve quality of required signal, we go for filtering. Filters can be Analog or digital. A digital filter is nothing but mathematical algorithm implemented in hardware or software. In Digital signal processing we have two categories types of filters.

1. IIR filter 2. FIR filter.

Both filters are characterized by its impulse response sequences. Input/ output relationship is given by the convolution formula. For IIR filter y[n] = � h[k]x[n-k] for causal sequence k ranges from 0 to ∞; or y[n] = � x[n]x[n-k] 0<k<∞; For FIR filter y[n] = � h[k]x[n-k] for causal sequence k ranges from 0 to N-1; or y[n] = � x[n]x[n-k] 0<k<N-1; Alternate form of FIR filter is: H[z] = � h[k]z-k for k ranging from 0 to ∞; One should use FIR filter for the given specification if

1. No phase distortion is desired 2. Number of filter coefficients are not too large.

There are several methods to design FIR filter, listed as follows: 1. Fourier series method 2. Windowing method 3. DFT method 4. Frequency sampling methods.

We have fourier series ranging from minus infinity to plus infinity, but we only look or windowed some part of the sequence ranging from –Q to +Q., where q is any positive integer. Hence this method is called as windowing technique. The various windowing sequences available are:

1. Hamming sequence. 2. Hanning sequence 3. Triangular sequence. 4. Kaiser sequence

Page 15: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

5. Blackman sequence. Program:- Simulation result:-

H[z] = { 0.0282-0.1409z-1+0,2817z-2-0.2817z-3+0.1409z-4-0.0282z-5} / {1+0.9437z-1+1.44z-2+0.9629z-3+0.5301z-4+0.1620z-5}

Discussion questions:-

1. Explain what is finite precision effect? 2. Give the relative comparison between IIR and FIR filter for Implementation.

Page 16: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment No. 08

Aim: To Study the Circular convolution and download it on TMS320C6713 DSK (DSP Starter Kit) Problem: To perform circular convolution of the following sequences x1(n) = [ 1,2,3,4] x2(n) = [1 ,1, 2, 1] Apparatus: TMS320C6713 DSK Theory: 1. Circular convolution: Convolution, as just described as

Steps Involved in Convolution 1) Time reverse the sequence

h[k] arriving at h[-k] 2) Shift h[-k] to the right by n sampling periods if n> 0 ,or to the left by n sampling period to form the sequence h[n-k] . 3) Product sequence:

v [k] = x[k] .h[n-k] 4) Summing all samples of v [k] then yields the nth sample y[n] of the 5) The process is implemented for each value of n in the range -�<n<+�. 6) The computation of output sequence is simply arithmetic operation such as addition , Multiplication and delays. 7) In case of discrete time system with an infinite length sequence, the output sequence is also of infinite length. 8) In circular convolution the length of the sequences are same .If they are not same then the length is made equal by zero padding 2. The C6713DSK: The C6713DSK is the low-cost standalone development platform that enables customers to evaluate and develop applications for the TI C67XX DSP family. The DSK also serves as a hardware reference design for the TMS3206713 DSP. A programmable logic device called CPLD is used to implement glue logic that lies the board component together. The CPLD register based user interface that lets the user configure the board by reading and writing to the CPLD registers. The DSK includes 4 LEDs and 4 DIPswitches as a simple way to provide the user with interactive feedback. A 5v power supply is used to power the board. Core composer communicates with the DSK through the embedded JTAG emulator with a USB host interface.

Page 17: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Procedure:

1) Open Code Composer Studio, make sure the DSP kit is turned on. 2) Start a new project using “Project -new” pull down menu, save it in a separate

directory(c:\ti\my\projects) with name circonv.pjt. 3) Add the source files Circular convolution to the project using ‘project ---- add

files to project’ pull down menu 4) Add linker command file hello.cmd

(Path:c:\ti\tutorial\dsk6713\hello1\hello.cmd) 5) Add the run time support library file rts6700.lib

(Path:c:\ti\c6000\cgtools\lib\rts6700.lib) 6) Compile the program using the ‘project –compile’ pull down menu. 7) Build the program using the ‘project –Build’ pull down menu 8) Load the program (lconv.out) in program memory of DSP chip using the ‘Field –

load program’ pull down menu.

Program: Simulation Results:

Page 18: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

x =1 8 20 25 16 y =1 2 -8 12 -10 z = -4.7463 -1.7506 -0.7516 + 1.1666i -0.7516 - 1.1666i p = -4.4885 1.3622 0.5632 + 1.1482i 0.5632 - 1.1482i k = 1 Discussion questions:

1. What are the basic conditions to be satisfied to perform the circular convolution. 2. What id DSP processor . 3. What are the main features of DSK TMS320C6713

Page 19: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment. No. 9

Aim: To design & implement digital Kaiser low pass FIR filter and observe its frequency response. Problem: To find Fir filter coefficients using MATLAB & design digital Kaiser low pass FIR filter and observe its frequency response. Filter specifications are: Order= 30; Sampling rate = 8000samples per second; Cut off frequency =400 Hz. Equipments:

• TMS 320C5416 architecture & instruction set. • Host (PC )with windows 95/98/Me/XP/NT/2000. • DSP kit with chip and device driver • Oscilloscope with function generator

Formulae : Cut-off frequency , Wc= 2*pi*fc/Fs; Desired Impulse Response: hdn (n using particular window) , b_rect1= fir1(order , Wc,’high’,boxcar(31)); Convolution= x[n]*h[n] Theory: The finite Impulse response (FIR )filter possesses an output response to an impulse which is of infinite duration.. The Impulse response is finite since there is no feedback in the filter that is if you put in an impulse then its output must produced for finite duration of time. Algorithm:

We need to realize the Kaiser low pass filter by implementing the difference equation y[n]= box[n]+ b1x[n-1]+ b2x[n-2]+…………….+ b25x[n-25], where bo to b25 are feed forward coefficients . the coefficients are calculated using MATLAB. A direct form Implementation is taken. Step 1: Initialise the McBSP, the DSP board and the on board coded. Step2: Initialise the discrete time system that is specify the initial conditions . Generally zero initial conditions are assumed. Step 3: Take sampled data from Coded. While input is fed to DSP kit from the signal generator since codec is stereo, take average of the input data, read from left and right channel. Store sampled data at a memory location. Step 4: Perform filter operation using above said difference equation. Store filter output at a memory location Step 5: Output the value to codec.(left channel and right channel) and view the output at oscilloscope. Step 6: GO to step 3.

Page 20: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Matlab program to generate ‘FIR filter –Low Pass coefficients using fir1. : C Program to Implement FIR filter: Procedure:

1) Switch on the DSP board. 2) Open the code composer studio. 3) Create a new project. 4) Initialize the McBSP, the DSP board and the on board coded. 5) Add the above given c source file to the current project. 6) Connect the speaker jack to the input of the CRO. 7) Build the program. 8) Load the generated object file on to target board. 9) Run the program using F5. 10) Observe the waveform that appears on the CRO screen.

Simulation Results:

Results: FIR filter coefficients were designed using MATLAB, the program was successfully downloaded on the DSP processor. The resultant waveforms were observed on the CRO.

Page 21: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Experiment. No. 9 Aim: To design & implement digital Butterworth high pass IIR filter and observe its frequency response. Problem: To find IIR filter coefficients using MATLAB & design digital Butterworth high pass IIR filter and observe its frequency response. Filter specifications are: Fc=8000 Hz Equipments:

• TMS 320C5416 architecture & instruction set. • Host (PC )with windows 95/98/Me/XP/NT/2000. • DSP kit with chip and device driver • Oscilloscope with function generator

Formulae : Cut-off frequency , Wc= 2*pi*fc/Fs; Desired Impulse Response: hdn (n using particular window) , b_rect1= iir1(order , Wc,’high’,boxcar(31)); Convolution= x[n]*h[n] Theory: The finite Impulse response (FIR )filter possesses an output response to an impulse which is of infinite duration.. The Impulse response is finite since there is no feedback in the filter that is if you put in an impulse then its output must produced for finite duration of time. Algorithm:

We need to realize the Kaiser low pass filter by implementing the difference equation y[n]= box[n]+ b1x[n-1]+ b2x[n-2]+…………….+ b25x[n-25], where bo to b25 are feed forward coefficients . the coefficients are calculated using MATLAB. A direct form Implementation is taken. Step 1: Initialise the McBSP, the DSP board and the on board coded. Step2: Initialise the discrete time system that is specify the initial conditions . Generally zero initial conditions are assumed. Step 3: Take sampled data from Coded. While input is fed to DSP kit from the signal generator since codec is stereo, take average of the input data, read from left and right channel. Store sampled data at a memory location. Step 4: Perform filter operation using above said difference equation. Store filter output at a memory location Step 5: Output the value to codec.(left channel and right channel) and view the output at oscilloscope. Step 6: GO to step 3.

Page 22: G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR …ghrce.raisoni.net/download/eleng_DSP.pdf · G.H.RAISONI COLLEGE OF ENGINEERING, NAGPUR Department:-Electronics & Communication ... Sinusoidal

Matlab program to generate ‘FIR filter –Low Pass coefficients using fir1. : C Program to Implement FIR filter: Procedure:

11) Switch on the DSP board. 12) Open the code composer studio. 13) Create a new project. 14) Initialize the McBSP, the DSP board and the on board coded. 15) Add the above given c source file to the current project. 16) Connect the speaker jack to the input of the CRO. 17) Build the program. 18) Load the generated object file on to target board. 19) Run the program using F5. 20) Observe the waveform that appears on the CRO screen.

Simulation Results:

Results: FIR filter coefficients were designed using MATLAB, the program was successfully downloaded on the DSP processor. The resultant waveforms were observed on the CRO.