Sunteți pe pagina 1din 9

Implement and design filter

Name Lab Partner(s): Lab Date: Thinh Nguyen Van May 24, 2011 Repetition:

Introduction: What is the purpose of this lab? Implement and design: 1. Low pass filter 2. High pass filter 3. Band pass filter

Hypothesis: (Predict the outcome(s) of the experiment) 1. In low pass filter, only signals whose frequency is below the cutoff frequency can pass. 2. In high pass filter, only signals whose frequency is above the cutoff frequency can pass 3. In band pass filter, signals whose frequency is in between two frequencies can pass

Procedures: (What steps did you take to accomplish this lab assignment?) I do this experiment in two ways: Simulink and *.m file. Method1: Using Simulink: Design the Simulink diagram as following figure:

Fig1: Simulink schematic filters

The parameters of low pass filter, high pass filter, band pass filter is set :

Fig2: Low pass filter parameters

Fig3: High pass filter parameters

Fig4: Band pass filter parameters


I change the frequency value of the source (sine source) to see the result in the output. I design the low pass filter, high pass filter and band pass filter all in a Simulink window. Method2: Using script file. We can use many algorithms to design filter such as Butterworth, Chebysev1, Chebysev2, Elliptic, Bessel. In this report, I use butterworth as an sample for designing, The other algorithms is similarity. Butterworth algorithm to design a low pass filter, a high pass filter, a band pass filter. The *m.file in matlab is implemented as follow: 1. Low pass filter: % For data sampled at 1000Hz, design a 3dB of % ripple in the passband, defined from of % attenuation in the stopband, definde frequency % (500HZ). Plot the filter's frequency Wp=40/500; Ws=150/500; Rp=3; Rs=60; [n,Wn]=buttord(Wp,Ws,Rp,Rs) [b,a]=butter(n,Wn,'low') freqz(b,a,512,1000) 2. High pass filter: % For data sampled at 1000Hz, design a than 3dB of % ripple in the passband, defined from % attenuation in the stopband, definde frequency % (500HZ). Plot the filter's frequency Wp=150/500; Ws=40/500; Rp=3; Rs=60; [n,Wn]=buttord(Wp,Ws,Rp,Rs); [b,a]=butter(n,Wn,'high') freqz(b,a,512,1000)

lowpass filter with less than 0 to 40 Hz, and at least 60dB from 150Hz to Nyquist response.

heighpass filter with less 150 Hz, and at least 60dB of from 0-40 Hz to Nyquist response.

3. Band pass filter: % Design a bandpass filter with passband of 60Hz to 200Hz with less than % 3dB of ripple in the passband, and 40dB attenuation in the stopbands % that are 50Hz wide on both sides of the passband. Wp=[60 200]/500; Rp=3; Rs=60; Ws=[10 250]/500; [n,Wn]=buttord(Wp,Ws,Rp,Rs) [b,a]=butter(n,Wn) freqz(b,a,512,1000) Method 3: Using FDAtool In matlab command window, type the command fdatool for opening the filter design and analysis tool. Fill the parameters in to design a filter. I design a filter with parameters as follow: Response Design Filter Density Fs Fpass Fstop Apass Astop type method order factor Low pass FIR Minimum 20 4800 200 800 1dB 80dB Equiripple order The Filter design and analysis tool window shown should be:

Fig5: FDA tool in filter design


The high pass filter and band pass filter is total similar to low pass filter design. There for, I dont express here.

Results: (Show your results) 1. Method1 (Simulink result): a. Low pass filter: Tested Source Comment Signal

Source frequency

range W<=1047

frequency w= 1000

Signal passes the filter. Magnitude is conserved totally.

1047<W <1570

w=1200

Signal is attenuated

w>1570

w=1600

Filter stops all signal.

b. High pass filter: Source frequency W<1047 Tested source frequency w=1000 Comment signal

Signal is stopped.

1047<W<1570

w=1200

Signal attenuate.

w>1570

w=1600

Signal is conserved

c.

Band pass filter: Test source frequency w=500 Comment signal

Source frequency W=2*pi*f/Fs w < 523

Signal is stopped.

523<w<1047

W=1000

Signal attenuate partly.

1047<w<1570

w=1200

Signal passes totally.

1570<w<2355

W=2000

Signal attenuates partly.

w>2355

W=2500

Signal is stopped.

2. Method2 (Script file result):

Fig6: Low pass filter signal

Fig7: High pass filter design

Fig8: Band pass filter design.

3. Method3 (FDAtool) The magnitude response of the filter be shown as follow:

Fig9: Filter in FDA tool

Conclusion:

(What did you learn? What conclusions can you draw form the results of this lab assignment? Compare the results of the experiment with you hypothesis.) The result in Matlab simulation is match with the prediction in hypothesis part. The low pass filter is used to take away the signal whose frequency is greater than cutoff frequency. In contrast, high pass filter is used to take away the frequency that smaller cutoff frequency. The band pass filter is the combination of both low pass filter and band pass filter. By using matlab simulation, we can design the filters as be shown in previous parts.

S-ar putea să vă placă și