Sei sulla pagina 1di 4

Lab #3 (Fourier Transform - 3)

This lab addresses the following course learning objective(s):


Understand a notch filter.
Apply CTFT in designing a notch filter.
Obtain frequency response of a filter.

In this lab, you will design a notch filter and a low pass filter. To design a notch filter,
the way explained in class will be used and verified by the magnitude plot in dB and
angle plot in degree. Those plots are called frequency responses (or Bode plot). To
draw the frequency responses of a filter, you need to read the freqs built-in function
in the MATLAB. In designing a low pass filter using a Butterworth filter, you need to
look at the butter built-in function. In addition, linspace function will help you draw
a Bode plot. (There is another built-in function, bode, to draw Bode plot. You will
learn it in Control Systems what it does)

1. Notch filter design


Lets use an example introduced in class to design a notch filter. The specifications for
a notch filter are given as follows:
a. Eliminate a 60Hz signal component. (i.e., the magnitude of a filter must be
less than -60 dB at 60 Hz).
b. Make the gain no more than -1 dB at 40 Hz and 80 Hz.
As you learned, the magnitude of a filter is obtained by the following equation. To use
the following equation, you need to think about where the poles and zeros must be in
the complex frequency domain. Once, you determine where the poles ( p k ) and zeros (
z k ) are located to satisfy the specifications, you can find other values such as A etc.
as explained in class. In the help file for freqs, note that the freqs uses H(s) instead
of H(jw). This means that you have to use s instead of jw if you want to draw
frequency responses with freqs built-in function.
N

| jw z k |
| H ( jw) | | A | k 1
D

| jw p
k 1
k |

or

| s z k |
| H (s) | | A | k 1
D

| s p
k 1
k |

Once you find out a transfer function H(jw), you can plot frequency responses of the
filter using freqs function. To use freqs, you need to know the coefficients of
denominator (for A input of freqs function) and the coefficients of numerator (for B
input of freqs function). Before you use the freqs function, you need to generate
radian frequency value using the linspace (or logspace). You can use it like this:

w = linspace(2*pi*10, 2*pi*100, 75);


Hnotch = freqs(Bnotch, Anotch, w);

Draw a magnitude plot and phase plot for a notch filter you designed. You can plot a
magnitude in dB and phase in degree with following commands.

subplot(211),plot(w/(2*pi),20*log10(abs(Hnotch))),grid on;
subplot(212),plot(w/(2*pi),(angle(Hnotch)*180/pi)),grid on;

Check whether your notch filter satisfies the given specifications from you plots.

2. Low Pass Filter (LPF) design using the Butterworth filter


The Butterworth filter is a way to design a LPF and it is defined as follows. The detail
parts of how to design a Butterworth filter will be explained in ENGR 420 class later.

1
H ( )
2N

1

c
where c is the desired cutoff frequency
N is the order of the filter (i.e., number of poles).

In this step, you will design a LPF based on the Butterworth filter model. The following
specifications for LPF are given:

a. Obtain a LPF having fc = 600 Hz.


b. It must have 3 poles

You can obtain all filter coefficients using the function butter. (Please check help file
for butter function) in continuous time or in discrete time. We are going to design a
Butterworth filter in continuous time in this lab as follows, where fc is a cutoff
frequency you want to design.

[Bbutter Abutter] = butter(N, 2*pi*fc, s);

In the above, example, N means an order of a Butterworth filter, and s implies that
filter coefficient in continuous time not in discrete time (Default is discrete time filter
coefficients). Obtain the frequency response using the function freqs as you did in the
Step 1. Before using freqs, define frequency [rad/s] points as like this:

w = linspace(2*pi*10, 2*pi*1000, 1000);


HButterworth = freqs(Bbutter, Abutter, w);

Draw a magnitude plot and phase plot for a Butterworth filter you designed. You can
plot a magnitude in dB and phase in degree with following commands.

subplot(211),plot(w/(2*pi),20*log10(abs(HButterworth))),grid on;
subplot(212),plot(w/(2*pi),(angle(HButterworth)*180/pi)),grid on;

Check whether your Butterworth filter satisfies the given specifications from you plots.
If you think that your result satisfies the specification, repeat Step 2 with different
order of your filter (i.e., with different number of poles) such as N=5 and N=8. Plot all
magnitude responses into a subplot with different colors and put all phase responses
into a subplot with different colors.

3. Lab report
Design a notch filter. The specifications for a notch filter are given as follows:

a. Eliminate a 1 KHz signal component. (i.e., the magnitude of a filter must be


less than 60 dB from unity.
b. Make the gain no more than 1 dB from unity at 980 Hz an 1020 Hz.

Submit all your calculations to design a notch filter and MATLAB codes with plots.
Submit all documents supporting your answers.

Potrebbero piacerti anche