Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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)
| 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:
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.
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:
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.
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:
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:
Submit all your calculations to design a notch filter and MATLAB codes with plots.
Submit all documents supporting your answers.