Google Search

Thursday, November 10, 2011

IIR Chebyshev Filter Design


   IIR Chebyshev Filter Design


AIM:- To design IIR Chebyshev digital filters.

THEORY: - IIR filters can be expanded as infinite impulse response filters. In designing IIR filters, cutoff frequencies of the filters should be mentioned. The order of the filter can be estimated using Chebyshev polynomial with the help of cutoff frequencies and the gain at that frequencies. That’s why the filters are named as Chebyshev filters. Filter coefficients can be found and the response can be plotted.

PROGRAM: -

wp = 200;
wq = 300;
rp = 2;
sp = 40;
fs = 1000;
wpn =  2 * wp / fs;
wqn = 2 *wq / fs ;
[ n wn ] = cheb1ord(wpn, wqn, rp, sp )
[ b a ] =cheby1(n, rp, wn );
[ h w ] = freqz(b, a, 128 );
plot( w/pi, abs(h) )


RESULT: -  A Chebyshev LPF is designed and response is plotted.



IIR Butter worth Filter Design dsp program


  IIR Butter worth Filter Design


AIM:- To design IIR Butterworth digital filters.

THEORY: - IIR filters can be expanded as infinite impulse response filters. In designing IIR filters, cutoff frequencies of the filters should be mentioned. The order of the filter can be estimated using butter worth polynomial. That’s why the filters are named as butter worth filters. Filter coefficients can be found and the response can be plotted.

PROGRAM: -

fs = 1000;
wpn = 2 * wp / fs;
wqn = 2 * wq / fs;
[ n wn ] = buttord( wpn, wqn, rp, sp )
[ b a ] = butter( n, wn )
[ h w ] = freqz( b, a, 128);
plot( (w/pi) * ( fs/2 ), abs(h) )


RESULT: -  A Butterworth LPF is designed and response is plotted.






FIR Filter Design


FIR Filter Design


AIM:- To design FIR digital filters.

THEORY: - FIR – filter is a finite impulse response filter. Order of the filter  should be specified. Infinite response is truncated to get finite impulse response. placing  a window of finite length does this. Types of windows available are Rectangular, Barlett, Hamming, Hanning, Blackmann window etc. This FIR filter is an all zero filter.

PROGRAM: -

n = 20;
fp = 200;
fq = 300;
fs = 1000;
fn = 2 * fp / fs;
window = Blackman ( n+1 );
b= fir1 ( n, fn , window )                        // low pass filter //
[ h w ] = freqz( b, 1, 128 );
plot( w/pi , abs(h) )


RESULT: -  A LPF is designed using Blackman window.







Frequency Response of Filter find frequency response of filter for specified coefficients.


Frequency Response of Filter


AIM:- To find frequency response of filter for specified coefficients.

THEORY: - Filter with coefficients are given. The frequency – magnitude plot gives the frequency response.

PROGRAM: -

b = [ 0.0995 0.1989 0.0995 ];
a = [ 1 -0.9316 0.3294 ];
[ h w ] = freqz ( b, a, 100 );
y = abs(h);
i = freqz( b, a, 100, 200 )
plot(i)
semilogx(w, y)


RESULT: -  Frequency response of specified filter is plotted.


DSP C PROGRAM Convolution and Correlation


Convolution and Correlation


AIM:- To find convolution and correlation of signals

THEORY: - If input is given to any system, output from the system is nothing  but convolution of input time signal and the system impulse response. Convolution in time domain is same as multiplication in frequency domain. Correlation is measurement of similarity. Cross correlation gives the similarity between two different signals whereas autocorrelation gives the similarity of the signal when the same signal was delayed. Fourier transform of autocorrelation is power spectral density of the signal (PSD)

PROGRAM: -

x = [ 1 1 -1 1 -1 -1 ];
h = [ -1 -1 1 -1 -1 -1 ];
y = conv( x, h )
cr = xcorr ( x , h )
plot ( cr )
title ( ‘ Plot of Cross correlation ‘ )
ylabel( ‘ Magnitude ‘ )
xlabel( ‘ Lag ‘)
ar = xcorr(x)
plot ( ar )

RESULT: - Convolution and Correlation plots were observed and plotted.





compute Magnitude and Phase of transformed signal using FFT using DSP


  Magnitude and Phase


AIM:- To compute Magnitude and Phase of transformed signal using FFT.

THEORY: - Fast Fourier Transform algorithms are faster algorithms to compute DFT. Magnitude and Phase plots can be observed for the Fourier transformed signal. Cestral  analysis is special case of frequency domain techniques.

PROGRAM: -

Fs = 1000;
T = 1/ Fs;
t = 0:T:1;
y = sin ( 2 * pi * 200 * t );            // generates sine wave of 200Hz //
plot(y)
z = fft(y,1024);     // gets 1024 point fft for y //
N = ( 0 :1023 )’ * Fs / 1024;
z1 = abs(z);
plot( N, z1)
title( ‘ FFT Plot ‘ )
z2 = angle (z);
plot( N, z2 )
title( ‘ Phase Plot ‘)

RESULT: - Magnitude and Phase plots were observed and plotted.








MAT LAB PROGRAM Computation using matrices To perform some arithmetic operations using matrices.


1.     Computation using matrices


AIM:- To perform some arithmetic operations using matrices.

THEORY: - ‘MATLAB ‘itself means that matrix laboratory. To compute matrix multiplications, addition, inverse of the matrix etc of any order can be obtained easily.

PROGRAM: -

A= [ 1 2 3; 4 5 6; 7 8 9 ];
B= [ 2 3 4; 5 4 7; 1 1 1 ];
C= A * B
D= A’
D1=D+2
E= INV (A)
F= A(3,1:3)
G= A(1:3;1 )
H= G.*G
SUM (H)

RESULT: - Basic arithmetic operations on matrices were observed using MATLAB.












DSP C PROGRAM to reveal the concept of circular buffering.


CIRCULAR BUFFERING

Aim: - To reveal the concept of circular buffering.

Apparatus: - TMS 320C 5416 processor

Program: -

            .include “5416_IV.asm”
            .data
            .word   1h,2h,3h,4h,5h            //  array of numbers //
            .text
            .include “intvect.asm”


Begin   STM    #1000h,AR5   //  data memory address //      
            STM    #2000h,AR6   //  output buffer //                   
STM    #4h,BK           //  loading the size of circular buffer to BK register //           
            STM    #20h,BRC
            RPTB  L1
            LD       *AR5+%,0,A
            STL     A,0,*AR6+
L1        NOP
            .end

Result: - The concept of circular buffering is observed

DSP C PROGRAM perform logical operations on two numbers residing in memory.


LOGICAL OPERATIONS

Aim: - To perform logical operations on two numbers residing in memory.

Apparatus: - TMS 320C 5416 processor

Program: -

            .include “5416_IV.asm”
            .data
            .word   0003h,0007h   //  input numbers //
            .text
            .include “intvect.asm”


Begin   STM    #1000h,AR5   // memory location of first number //
            STM    #1001h,AR4   // memory location of second number //
            STM    #1500h,AR3   // memory location of result due to AND operation //
            STM    #1600h,AR2   // memory location of result due to OR operation //
            STM    #1700h,AR1   // memory location of result due to NEGATE operation //
            LD       *AR5,A
            LD       *AR4,B
            AND   A,0,A
            OR      B,0,B
            STL     A,*AR3
            STL     B,*AR2
            LD       *AR5,A
            NEG    A
            STL     A,*AR1
            .end

Result: - The logical operations are performed on a number.





DSP C perform left shift and right shift operation on a number residing in memory.


SHIFTING

Aim: - To perform left shift and right shift operation on a number residing in memory.

Apparatus: - TMS 320C 5416 processor

Program: -

            .include “5416_IV.asm”
            .data
            .word   0003h,             //  input number //
            .text
            .include “intvect.asm”


Begin   STM    #1000h,AR5   // memory location of first number //
            STM    #1600h,AR2   // memory location of left shifted number //
            STM    #1500h,AR3   // memory location of right shifted number //
            LD       *AR5,A
            LD       *AR5,B
            SFTA  A,-1
            SFTA  B,1
            STL     A,*AR2
            STL     B,*AR3
            .end

Result: - Shifting the number left by one bit is equivalent to multiplying number by 2
               Shifting the number left by one bit is equivalent to dividing number by 2