ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB

Download Report

Transcript ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB

Engineering 43
nd
2
order Filters
MATLAB BodePlt
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
[email protected]
Engineering-43: Engineering Circuit Analysis
1
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Signal Filters
 The FOUR Basic Filter Types:
• Lowpass filters PASS LOW frequencies
and attenuate high frequencies.
• Highpass filters PASS HIGH frequencies
and attenuate low frequencies.
• Bandpass filters PASS A CERTAIN BAND
of frequencies, and attenuate all else
• Bandstop (also called bandREJECT or
NOTCH) filters ATTENUATE A CERTAIN
BAND of frequencies, and pass all else
Engineering-43: Engineering Circuit Analysis
2
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
IDEAL Signal Filters
 Ideal Filters Characteristics:
• The lowpass filter passes all frequencies below fc.
• The highpass filter passes all frequencies above fc.
• The bandpass filter passes all frequencies
between fc1 and fc2.
• The bandstop (or Notch) filter attenuates all
frequencies between fc1 and fc2.
Engineering-43: Engineering Circuit Analysis
3
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC LOWpass Filter
 Last Time We analyzed
the RLC BAND-pass Filter
 ReArrange the RLC Series Ckt to
Produce LOW-passBehavior

VO

Engineering-43: Engineering Circuit Analysis
4
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC LOWpass Filter
 Using Frequency Domain VoltageDivider Analysis:
VO
ZC
1  j 2fC 
 Vin
 Vin
Z L  R  ZC
j 2fL  R  1  j 2fC 
 As before f  1
2f 0 L
QS 
0
2 LC
R
use:
 With Enough Complex Algebra find:
VO
 jQS  f 0 f 
H f 

Vin 1  jQS  f f 0  f 0 f 
Engineering-43: Engineering Circuit Analysis
5
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC LoPass Performance
20
Q=0.5
Q=1
Q=2
Q=5
10
RLC LoPass |H(f)| (dB)
0
-10
Don’t Like the
Humps, Take Q≈1
-20
-30
-40
-50
-60
-70
u = logspace(-1,3,500); % u = f/f0
H_5 = 20*log10(abs((-j*0.5*(1./u))./(1+j*0.5*(u-1./u))));
H1 = 20*log10(abs((-j*1*(1./u))./(1+j*1*(u-1./u))));
H2 = 20*log10(abs((-j*2*(1./u))./(1+j*2*(u-1./u))));
H5 = 20*log10(abs((-j*5*(1./u))./(1+j*5*(u-1./u))));
semilogx(u,H_5, u,H1, u,H2, u,H5, 'LineWidth',3), grid
axis([0.1 100 -80 20])
LoPasslegend = legend('Q=0.5','Q=1','Q=2','Q=5');
xlabel('f/f_{0}')
ylabel(' RLC LoPass |H(f)| (dB)‘)
-80
-1
10
Engineering-43: Engineering Circuit Analysis
6
0
1
10
10
f/f0
2
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC HIGHpass Filter
 Last Time We analyzed
the RLC BAND-pass Filter
 ReArrange the RLC Series Ckt to
Produce HIGH-passBehavior

VO

Engineering-43: Engineering Circuit Analysis
7
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC HIGHpass Filter
 Using Frequency Domain VoltageDivider Analysis:
VO
ZL
j 2fL
 Vin
 Vin
Z L  R  ZC
j 2fL  R  1  j 2fC 
 As before f  1
2f 0 L
QS 
0
2 LC
R
use:
 With Enough Complex Algebra find:
VO
jQS  f f 0 
H f 

Vin 1  jQS  f f 0  f 0 f 
Engineering-43: Engineering Circuit Analysis
8
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC HiPass Performance
20
Don’t Like the
Humps, Take Q≈1
RLC LoPass |H(f)| (dB)
10
0
-10
-20
-30
u = logspace(-1,3,500); % u = f/f0
H_5 = 20*log10(abs((j*0.5*u)./(1+j*0.5*(u-1./u))));
H1 = 20*log10(abs((j*1*u)./(1+j*1*(u-1./u))));
H2 = 20*log10(abs((j*2*u)./(1+j*2*(u-1./u))));
H5 = 20*log10(abs((j*5*u)./(1+j*5*(u-1./u))));
semilogx(u,H_5, u,H1, u,H2, u,H5, 'LineWidth',3), grid
axis([0.1 100 -40 20])
LoPasslegend = legend('Q=0.5','Q=1','Q=2','Q=5');
xlabel('f/f_{0}')
ylabel(' RLC LoPass |H(f)| (dB)')
-40
-1
10
Engineering-43: Engineering Circuit Analysis
9
Q=0.5
Q=1
Q=2
Q=5
0
1
10
10
f/f0
2
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC NOTCH (BandReject) Filter
 Last Time We analyzed
the RLC Band-PASS Filter
 ReArrange the RLC Series Ckt to
Produce BandREJECT Behavior

VO

Engineering-43: Engineering Circuit Analysis
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC BandReject (notch) Filter
 Using Frequency Domain VoltageDivider Analysis:
VO
Z L  ZC
 Vin
Z L  R  ZC
j 2fL  1  j 2fC 
Vin
j 2fL  R  1  j 2fC 
 As before f  1
2f 0 L
QS 
0
2 LC
R
use:
 With Enough Complex Algebra find:
VO
jQS  f f 0  f 0 f 
H f 

Vin 1  jQS  f f 0  f 0 f 
Engineering-43: Engineering Circuit Analysis
11
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC Notch Performance
10
Q=0.5
Q=1
Q=2
Q=5
RLC Notch |H(f)| (dB)
0
-10
-20
-30
-40
u = logspace(-2,2,1500); % u = f/f0
H_5 = 20*log10(abs((j*0.5*(u-1./u))./(1+j*0.5*(u-1./u))));
H1 = 20*log10(abs((j*1*(u-1./u))./(1+j*1*(u-1./u))));
H2 = 20*log10(abs((j*2*(u-1./u))./(1+j*2*(u-1./u))));
H5 = 20*log10(abs((j*5*(u-1./u))./(1+j*5*(u-1./u))));
semilogx(u,H_5, u,H1, u,H2, u,H5, 'LineWidth',2), grid
axis([0.01 100 -50 10])
LoPasslegend = legend('Q=0.5','Q=1','Q=2','Q=5');
xlabel('f/f_{0}')
ylabel(' RLC Notch |H(f)| (dB)‘)
-50
-2
10
-1
10
Engineering-43: Engineering Circuit Analysis
12
0
10
f/f0
1
10
2
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
RLC bandPASS Performance
10
H f 
1
Q=0.5
Q=1
Q=2
Q=5
1  jQS  f f 0  f 0 f 
RLC BandPASS |H(f)| (dB)
0

-10
VO

-20
-30
-40
-50
-2
10
u = logspace(-2,2,1500); % u = f/f0
H_5 = 20*log10(abs((j*0.5*(u-1./u))./(1+j*0.5*(u1./u))));
H1 = 20*log10(abs((j*1*(u-1./u))./(1+j*1*(u-1./u))));
H2 = 20*log10(abs((j*2*(u-1./u))./(1+j*2*(u-1./u))));
H5 = 20*log10(abs((j*5*(u-1./u))./(1+j*5*(u-1./u))));
semilogx(u,H_5, u,H1, u,H2, u,H5, 'LineWidth',2), grid
axis([0.01 100 -50 10])
LoPasslegend = legend('Q=0.5','Q=1','Q=2','Q=5');
xlabel('f/f_{0}')
ylabel(' RLC Notch |H(f)| (dB)‘)
-1
10
Engineering-43: Engineering Circuit Analysis
13
0
10
f/f0
1
10
2
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
WhiteBoard Work
 The RLC Notch Filter has the
disadvantage of Using an INDUCTOR
• L’s are Large & Heavy relative to R’s & C’s
 An Alternative is the “dual-T” Notch
Filter
Which
Eliminates
the
Inductor
Engineering-43: Engineering Circuit Analysis
14
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
WhiteBoard Work
 For the Dual-T Notch Filter
• Use Hand-Analysis to Derive the
TRANSFER FUNCTION
• Use MATLAB to Create the BODE PLOT
for the case where R = 2kΩ & C=120nF
Engineering-43: Engineering Circuit Analysis
15
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
dualT Notch Filter Magnitude
Dual-T Notch Filter: R=2k, C=120n
10
0
|H(f)| (dB)
-10
-20
-30
-40
-50
1
10
0  4167Rads Sec
2
10
Engineering-43: Engineering Circuit Analysis
16
3
10
4
10
 = 2f (rad/s)
5
10
6
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
dualT Notch Filter Phase
Dual-T Notch Filter: R=2k, C=120n
50
40
30
Angle H(f) (°)
20
10
0
-10
-20
-30
0  4167Rads Sec
-40
-50
1
10
2
10
Engineering-43: Engineering Circuit Analysis
17
3
10
4
10
 = 2f (rad/s)
5
10
6
10
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
18
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
MATLAB Code
% Bruce Mayer, PE
% ENGR43 • 17Jul11
% Lec6c_Dual_T_NotchFilter_1107.m
%
w = logspace(1,6,1500); % w = 2*pi*f
%
syms K
HK = ((1+1/K)+ K*(1+K))/(2*(1+K)^2*(1+1/K)-K*(1+K)-(1+1/K))
Hsimp = simplify(HK)
%
C = 120e-9; R = 2000;
H = (1-C^2*R^2*w.^2)./((1-C^2*R^2*w.^2) + j*4*w*C*R);
Hmag = 20*log10(abs(H));
Hphi = angle(H)*180/(2*pi);
semilogx(w,Hmag, 'LineWidth',3), grid
axis([10 1e6 -50 10])
xlabel('\omega = 2\pif (rad/s)')
ylabel('|H(f)| (dB)')
title('Dual-T Notch Filter: R=2k, C=120n')
% PAUSE Coming
disp('showing MAG plot; hit ANY KEY to continue')
pause
% Plot Phase Angle
semilogx(w,Hphi, 'LineWidth',3), grid
axis([10 1e6 -50 50])
xlabel('\omega = 2\pif (rad/s)')
ylabel('Angle H(f) (°)')
title('Dual-T Notch Filter: R=2k, C=120n')
All Done for Today
Butterworth’s
Original
1930 Work
Engineering-43: Engineering Circuit Analysis
19
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering 43
Appendix
Bruce Mayer, PE
Licensed Electrical & Mechanical Engineer
[email protected]
Engineering-43: Engineering Circuit Analysis
20
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
21
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
22
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
23
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
24
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
25
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx
Engineering-43: Engineering Circuit Analysis
26
Bruce Mayer, PE
[email protected] • ENGR-43_Lec-06c_2ndOrder-Filter_MATLAB-BodePlots.pptx