third-order butterworth high-pass filter design example · web viewfor the digital filter being...
TRANSCRIPT
EE490 WK6 Lab Detailed Solutions
Objectives
Design a third-order Butterworth filter with given structure and cutoff frequency. Demonstrate detailed steps to derive the transfer function for the circuit being
designed. Interpret the MATLAB-generated frequency response showing that the filtering
characteristics fulfilled the design specifications. For the filter being designed, discuss the stability based on frequency and time
responses. Based on the analog transfer function, demonstrate detailed steps to derive its
digital counterpart and demonstrate detailed steps to derive z-domain transfer function.
For the digital filter being designed, discuss the stability based on z-domain frequency and time-domain responses by transfer function and the difference equation.
Analytically summarize the comparisons between the results obtained from various parts of the lab and submit a formal lab report.
Pre-Lab Example
Part I: Design a Third-order Butterworth Low-pass Filter
Design Specifications:
Design a third-order Butterworth low-pass filter with R=1-K-ohms, at cutoff frequency = 20 K-Hz (ωc=2πf=2π(20K)) rad/sec.
The circuit structure of the filter is depicted as below.
Obtain circuit values:
Using the equations given:
L= 4 R3 ωc
= 4 K3×2 π × 20 K
=10.61 mH
C1=1
2 R ωc= 1
2× 1 K × 2 π ×20 K=3.98 nF
C2=3
2 R ωc= 3
2× 1 K × 2 π ×20 K=11.94 nF
The detailed steps to derive the transfer function for the circuit:
First assume inductor as Z, the C1 capacitor as Z1, and the C2 capacitor as Z2.
V1
Zp
Assume the node between 1 K resistor and the inductor as V1.
According to voltage divider rule:
V 0
V 1= Z 2
Z 2+Z
The parallel resistance:
Zp=(Z+Z 2)× Z 1Z+Z 2+Z 1
Again according to voltage divider rule:
V 1
V ¿= Zp
Zp+R=
(Z+Z 2)× Z 1Z+Z 2+Z 1
(Z+Z 2)× Z 1Z+Z 2+Z 1 +R
=(Z+Z 2)× Z 1
( Z+Z 2 )× Z 1+R (Z+Z 2+Z 1)
Therefore the overall transfer function:
V 0
V ¿=
V 0
V 1×
V 1
V ¿= Z 2
Z 2+Z×
(Z+Z 2)× Z 1(Z+Z 2 ) × Z 1+R(Z+Z 2+Z 1)
= Z 1 × Z 2(Z+Z 2 ) × Z 1+R(Z+Z 2+Z 1)
Based on Laplace impedance for L and C components:
Z 1= 1sC1
; Z 2= 1sC2
;Z=sL
Plug into the above transfer function:
V 0
V ¿= Z 1× Z 2
( Z+Z 2 )× Z 1+ R(Z+Z 2+Z 1)
¿
1sC1
× 1sC2
(sL+ 1sC 2 )×
1sC 1
+R(sL+ 1sC2
+ 1sC1
)= 1
RLC1C 2 s3+L c2 s2+(C 1+C 2 ) Rs+1
Plug R, L, and C values into the transfer function:
RLC1C2=1 K × 10.61mH ×3.98 nF ×11.94 nF=504.2 ×10−18
L c2=10.61 mH ×11.94 nF=126.68× 10−12
(C1+C2 ) R=(3.98 nF+11.94nF ) ×1 K=15.92 ×10−6
V 0
V ¿= 1
504.2 ×10−18s3+126.68 ×10−12 s2+15.92 ×10−6 s+1
Use MATLAB to generate the frequency response of this third-order filter:
>> num=[1];>> den=[(504.2e-18), (126.68e-12), (15.92e-6), 1];>> bode(num,den); grid on
103
104
105
106
107
-270
-180
-90
0
Phas
e (d
eg)
Bode Diagram
Frequency (rad/s)
-120
-100
-80
-60
-40
-20
0
System: sysFrequency (rad/s): 1.25e+05Magnitude (dB): -3.02
Mag
nitu
de (d
B)
103
104
105
106
107
-270
-180
-90
0
Phas
e (d
eg)
Bode Diagram
Frequency (rad/s)
-120
-100
-80
-60
-40
-20
0
System: sysFrequency (rad/s): 1.25e+05Magnitude (dB): -3.02
System: sysFrequency (rad/s): 1.25e+06Magnitude (dB): -60
Mag
nitu
de (d
B)
Interpret the MATLAB Results:
The above MATLAB result shows the expected filtering characteristics as designed (note the angular frequency = 2*pi*f=2*3.14159*20K=125.6K. This cutoff frequency of the high-pass filter is illustrated in the Bode plot).
The above MATLAB result also shows the expected filtering characteristics as designed (note that for one decade, the slope on the Bode plot=-60 dB).
For the filter being designed, discuss the stability based on its characteristic roots and s-domain pole-zero mapping:
The filter characteristic equation:
504.2× 10−18 s3+126.68× 10−12 s2+15.92 ×10−6 s+1=0
>> num=[1];>> den=[(504.2e-18), (126.68e-12), (15.92e-6), 1];>> TF=tf(num, den);>> pzmap(TF); grid on
-14 -12 -10 -8 -6 -4 -2 0
x 104
-1.5
-1
-0.5
0
0.5
1
1.5x 10
5
0.360.480.62
0.78
0.94
2e+04
4e+04
6e+04
8e+04
1e+05
1.2e+05
1.4e+05
2e+04
4e+04
6e+04
8e+04
1e+05
1.2e+05
1.4e+05
0.080.160.260.360.480.62
0.78
0.94
0.080.160.26
Pole-Zero Map
Real Axis (seconds-1)
Imag
inar
y Ax
is (s
econ
ds-1
)
The characteristic roots:
>> R=roots([(504.2e-18), (126.68e-12), (15.92e-6), 1]);
R =
1.0e+05 *
-1.2558 -0.6283 + 1.0884i -0.6283 - 1.0884i
Because all real parts of the characteristic roots are in the left side of s-domain, the system is stable.
For the filter being designed, discuss the stability based on its step response in time-domain:
>> step(num, den), grid on
0 0.2 0.4 0.6 0.8 1 1.2
x 10-4
0
0.2
0.4
0.6
0.8
1
1.2
1.4Step Response
Time (seconds)
Ampl
itude
The above time response shows a stable system.
For the above system, given the step input signal:
v¿=u (t)
Find the differential equation of the system to unit step input; Find the time domain mathematical expression for Vout by solving the above
differential question; Find the time domain response curve based on the time domain mathematical
expression.
Solution:
V ¿ ( s)=L [u( t)]=1s
Because the transfer function is:
V 0
V ¿= 1
504.2 ×10−18s3+126.68 ×10−12 s2+15.92 ×10−6 s+1
V out=1
504.2 ×10−18 s3+126.68× 10−12 s2+15.92 ×10−6 s+1×V ¿=
1504.2 ×10−18 s3+126.68 ×10−12 s2+15.92 ×10−6 s+1
× 1s
d1 =
0.000000000000001 0.000000000126680 0.000015920000000
1.000000000000000 0
Therefore, the differential equation is:
0.000000000000001×d4 vout (t )
d t 4 +0.000000000126680 ×d3 vout (t)
d t3 +0.000015920000000×d2v out (t)
d t 2 +1.000000000000000 ×d vout ( t )
dt=1
The solution to the above differential equation:
It seems the fourth order is difficult for MATLAB to handle. First, reduce to the third order, then use MATLAB to find the time domain solution:
V out ( t )=f (t)
syms t stf=1./((1.267e-10)*s^3+(1.592e-05)*s^2+s);
ilaplace(tf,s,t) ans = 1 - exp(-(307937584772238344192*t)/4901468843045553)*(cos((65536*22070211245040816978594077050367^(1/2)*t)/4901468843045553) + (4698754650455297*22070211245040816978594077050367^(1/2)*sin((65536*22070211245040816978594077050367^(1/2)*t)/4901468843045553))/22070211245040816978594077050367)
The above expression is the time domain solution to the original differential equation in the form of:
V out ( t )=f (t)
Time domain response based on the time domain mathematical expression (make sure to replace / with ./ and * with .* to convert the data format):
>> t=0:0.00001:.00012;
>> y=1 - exp(-(307937584772238344192.*t)./4901468843045553).*(cos((65536.*22070211245040816978594077050367^(1./2).*t)./4901468843045553) + (4698754650455297.*22070211245040816978594077050367^(1./2).*sin((65536.*22070211245040816978594077050367^(1./2).*t)./4901468843045553))./22070211245040816978594077050367); plot(t,y); grid on
0 0.2 0.4 0.6 0.8 1 1.2 1.4
x 10-4
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Part II: Analysis of the Digital Equivalence of the Third-order Butterworth Low-pass Filter Being Designed
Detailed steps to derive the digital counterpart using BLT: Because the s-domain transfer function is:
V 0
V ¿= 1
504.2 ×10−18s3+126.68 ×10−12 s2+15.92 ×10−6 s+1
¿ 1/(504.2 ×10−18)s3+(126.68 ×10−12)/(504.2 ×10−18)s2+(15.92× 10−6)/(504.2 ×10−18)s+1 /(504.2× 10−18)
Let
TF ( s)=V 0
V ¿= 1.983× 1015
s3+a× s2+b×s+c
Perform the bilinear transformation (BLT)
s= 2T
× z−1z+1
Therefore,
TF ( z )=V 0
V ¿=1.983× 1015
¿¿
TF ( z )=V 0
V ¿=
1.983× 1015× (z+1 )3
¿¿
¿1.983 ×1015(z3+3 × z2+3 × z+1)
[( 2T )
3
+a( 2T )
2
+b( 2T )+c ]× z3+[−( 2
T )3
×3−a( 2T )
2
+b( 2T )+3c ]× z2+[3( 2
T )3
−a( 2T )
2
−b( 2T )+3c ]× z+[−( 2
T )3
+a ( 2T )
2
−b( 2T )+c ]
To Derive Z-domain Transfer Function:
Let sampling frequency fs=80000; T=1/80000=1.25e-5
TF:
>> T=1.25e-5; a=0.2512e6; b=.0316e12;c=1.983e15;fs=80000;>> num=[1.983e15, +3*1.983e15, +3*1.983e15, +1.983e15]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c)>> den=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c),(-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c)
num =
0.112890334128063 0.338671002384189 0.338671002384189
0.112890334128063
den =
1.000000000000000 -0.439134860398549 0.384287122873415
-0.042029589450361
Verify using BLT command:
V 0
V ¿= 1
504.2 ×10−18s3+126.68 ×10−12 s2+15.92 ×10−6 s+1
format long
fs=80000;%sampling rate
B =[1];
A = [504.2e-18 126.68e-12 15.92e-6 1];
[b a]=bilinear(B,A,fs)
b = 0.112925303796169 0.338775911388507 0.338775911388509
0.112925303796170
a =
1.000000000000000 -0.439439514677760 0.384556010227961 -0.041714065180847
Therefore, the z-domain transfer function is
TF ( z )= 0.112925303796169+0.338775911388507 × z−1+0.338775911388509× z−2+0.112925303796170× z−3
1.000000000000000−0.439439514677760 × z−1+0.384556010227961× z−2−0.041714065180847 × z−3
Z-domain Frequency Response:
>> T=1.25e-5; a=0.2512e6; b=.0316e12;c=1.983e15;fs=80000;>> num=[1.983e15, +3*1.983e15, +3*1.983e15, +1.983e15]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c)>> den=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c),(-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c)>> freqz(num, den, 80000, fs), grid on
0 0.5 1 1.5 2 2.5 3 3.5 4
x 104
-300
-200
-100
0
Frequency (Hz)
Pha
se (d
egre
es)
0 0.5 1 1.5 2 2.5 3 3.5 4
x 104
-300
-200
-100
0X: 1.996e+04Y: -7.141
Frequency (Hz)
Mag
nitu
de (d
B)
format long
fs=80000;%sampling rate
B =[1];
A = [504.2e-18 126.68e-12 15.92e-6 1];
[b a]=bilinear(B,A,fs)
>> freqz(b, a, 80000, fs), grid on
0 0.5 1 1.5 2 2.5 3 3.5 4
x 104
-300
-200
-100
0
Frequency (Hz)
Pha
se (d
egre
es)
0 0.5 1 1.5 2 2.5 3 3.5 4
x 104
-300
-200
-100
0
Frequency (Hz)
Mag
nitu
de (d
B)
For the digital filter being designed, discuss the stability based on its zero-pole map and z-domain stability criterion.
TF ( z )=0.112925303796169+0.338775911388507 × z−1+0.338775911388509 × z−2+0.11292530379617× z−3
1−0.439439514677760 × z−1+0.384556010227961× z−2−0.041714065180847 × z−3
The filter zero-pole map:
>> T=1.25e-5; a=0.2512e6; b=.0316e12;c=1.983e15;fs=80000;>> num=[1.983e15, +3*1.983e15, +3*1.983e15, +1.983e15]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> den=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c),(-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c);sys = tf(num,den,T); % discrete systemP = pole(sys)Z = zero(sys)zplane(Z,P); grid on
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
3
Real Part
Imag
inar
y P
art
>> T=1.25e-5; a=0.2512e6; b=.0316e12;c=1.983e15;fs=80000;>> n=[1.983e15, +3*1.983e15, +3*1.983e15, +1.983e15]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> d=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c),(-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> zplane(n,d); grid on
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
3
Real Part
Imag
inar
y P
art
Because the magnitudes of all poles are within the unit circle, the system is stable.
For the above digital filter, given the step input signal:
Find the difference equation of the system to unit step input; Find the time domain response curve based on the difference equation obtained
above.
Difference equation:
y (n )=0.439439514677760× y (n−1 )−0.384556010227961 × y (n−2 )+0.041714065180847 × y (n−3 )+0.112925303796169 × x (n)+0.338775911388507 × x (n−1)+0.338775911388509 × x (n−2)+0.11292530379617 × x (n−3)
Time Response to Unit Step Input Based on Difference Equation
>> input=ones([1 18]); %unit step input for 18 sampling points>> x=[0 0 0 input];%unit input with first three to be zero initial condition>> y=[0 0 0 zeros(1, length(input))]; %initial output to zeros>> for n=4:1:length(x); %padding for 4 to include initial condition
y (n )=0.439439514677760∗y (n−1 )−0.384556010227961∗y (n−2 )+0.041714065180847∗y (n−3 )+0.112925303796169∗x (n )+0.338775911388507∗x (n−1 )+0.338775911388509∗x (n−2 )+0.11292530379617∗x (n−3 );>> end>> y(4:1:length(x))
ans =
0.1129 0.5013 0.9674 1.1404 1.0535 0.9681
0.9713 1.0019 1.0105 1.0027 0.9972 0.9982
1.0004 1.0008 1.0001 0.9998 0.9999 1.0000
Plot the discrete time response:
>> SamplePoints=[0:1:17];
>> stem(SamplePoints, [0.1129 0.5013 0.9674 1.1404 1.0535 0.9681 0.9713 1.0019 1.0105 1.0027 0.9972 0.9982 1.0004 1.0008 1.0001 0.9998 0.9999 1.0000]); grid on
0 2 4 6 8 10 12 14 16 180
0.2
0.4
0.6
0.8
1
1.2
1.4
Based on the above discrete time respond to unit step input, the system is stable.
Another method to find time domain response curve based on the difference equation:
The difference equation is:
y (n )−0.439439514677760× y (n−1 )+0.384556010227961× y (n−2 )−0.041714065180847 × y (n−3 )¿0.112925303796169 × x (n)+0.338775911388507 × x(n−1)+0.338775911388509× x (n−2)+0.11292530379617 × x (n−3)
>> T=1.25e-5; a=0.2512e6; b=.0316e12;c=1.983e15;fs=80000;>> num=[1.983e15, +3*1.983e15, +3*1.983e15, +1.983e15]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> den=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c),(-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> n = 0:18;[g2,x] = dstep(num,den,length(n)); %find g from difference equation>> stem(n,g2);title('Step response from difference equation'); grid on
0 2 4 6 8 10 12 14 16 180
0.2
0.4
0.6
0.8
1
1.2
1.4Step response from difference equation
Verify the above discrete step response based on the z-domain transfer function and MATLAB stepz(…) command
>> T=1.25e-5; a=0.2512e6; b=.0316e12;c=1.983e15;fs=80000;>> n=[1.983e15, +3*1.983e15, +3*1.983e15, +1.983e15]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> d=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c),(-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c);>> stepz(n,d); grid on
0 2 4 6 8 10 12 14 16 180
0.2
0.4
0.6
0.8
1
1.2
1.4Step response from difference equation
0 2 4 6 8 10 12 14 160
0.2
0.4
0.6
0.8
1
1.2
1.4
n (samples)
Am
plitu
de
Step Response
Lab Steps: Perform the Following Lab Steps
Part I: Analog Filter Design
Design a third-order Butterworth high-pass filter with R=1-K-ohms, at cutoff frequency = 2 K-Hz (ωc=2πf=2π(2K)) rad/sec.
Obtain filter circuit component values. Demonstrate detailed steps to derive the transfer function for the circuit. Use MATLAB to generate the frequency response of this third-order filter being
designed. Interpret the MATLAB frequency response result showing that the filtering
characteristics fulfill the design specifications. For the filter being designed, discuss the stability based on its characteristic roots
and its s-domain pole-zero mapping. For the filter being designed, discuss the stability based on its step response in
time-domain.
Part II: Analysis of the Digital Equivalence of the Third-order Butterworth Filter Being Designed
Based on the analog transfer function obtained in Part I, demonstrate detailed steps to derive its digital counterpart using bilinear transformation (BLT).
s= 2T
× z−1z+1
Determine a reasonable sampling frequency fs, and demonstrate detailed steps to derive z-domain transfer function.
Verify the BLT result using MATLAB BLT command. Demonstrate the steps to obtain z-domain frequency response. For the digital filter being designed, discuss the stability based on its zero-pole
map and z-domain stability criterion. Verify the above discrete step response based on the z-domain transfer function
and MATLAB stepz(…) command. For the above digital filter, given the step input signal:
o Find the difference equation of the system to unit step input; o Find the time domain response curve based on the difference equation
obtained above; ando Interpret filter stability based in the discrete time response to unit step
input.
Part III: Comparative Analysis
Summarize the comparisons between the results obtained from Part I and Part II.Lab Steps—Detailed Solutions
Part 1: Analog Filter Design
Design a third-order Butterworth high-pass filter with R=1-K-ohms, at cutoff frequency = 2 K-Hz (ωc=2πf=2π(2K)) rad/sec.
Solution:
As discussed, the circuit structure of the Butterworth low-pass filter is shown in the following figure (b):
To change the filter type to a high-pass, we replace each capacitor with an inductor, and replace the inductor with a capacitor, using the equations given:
L1=2 Rωc
= 2 K2 K (2 π )
=0 .159 H ; L2=2 R3 ωc
= 2 K6 K (2 π )
=0 .053 H
C= 34 Rωc
= 34 K (2 K )(2 π )
=60 nF
The following circuit shows the circuit implementation of the design.
The detailed steps to derive the transfer function for the circuit:
1) First assume 0.053 H inductor is Z2, the 0.159 H inductor as Z1, and the 60 nF capacitor as Zc. Assume 1 K resistor as R.
2) Assume the node between 1 K resistor and the 60 nF resistor as V1.
According to voltage divider rule:
V 0
V 1= Z 2
Z 2+Zc
The parallel resistance:
Zp=(Zc+Z 2)× Z 1Zc+Z 2+Z 1
Again according to voltage divider rule:
V 1
V ¿= Zp
Zp+R=
(Zc+Z 2)× Z 1Zc+Z 2+Z 1
(Zc+Z 2)× Z 1Zc+Z 2+Z 1 +R
=(Zc+Z 2)× Z 1
(Zc+Z 2 ) ×Z 1+R(Zc+Z 2+Z 1)
Therefore the overall transfer function:
V1V
Parallel Impedance, Zp
V 0
V ¿=
V 0
V 1×
V 1
V ¿= Z 2
Z 2+Zc×
(Zc+Z 2)× Z 1( Zc+Z 2 )× Z 1+R (Zc+Z 2+Z 1)
= Z 1 × Z 2( Zc+Z 2 ) × Z 1+R(Zc+Z 2+Z 1)
Based on Laplace impedance for L and C components:
Zc= 1sC
;Z 1=s L1; Z 2=s L2
Plug into the above transfer function:
V 0
V ¿= Z 1 × Z 2
( Zc+Z 2 )× Z 1+R (Zc+Z 2+Z 1)=
s L1 × s L2
( 1sC
+s L2)× s L1+R( 1sC
+s L2+s L1)= s3
s3+(L¿¿1+ L2)R
L1 × L2× s2+
1L2×C × s+ R
L1 × L2× C ¿
Plug R, L, and C values into the transfer function:
(L¿¿1+L2) RL1× L2
=( .159+ .053 )1000
.159 × .053=25157¿
1L2×C
= 1.053× 60× 10−9 =314465409
RL1× L2 ×C
= 1000.159 × .053 ×60 ×10−9 =1.977770000000
V 0
V ¿= s3
s3+25157 × s2+314465409× s+1977770000000
Use MATLAB to generate the frequency response of this third-order filter:
>> num=[1 0 0 0];>> den=[1 25157 314465409 1977770000000];>> bode(num,den); grid on
102
103
104
105
106
0
90
180
270
Phas
e (d
eg)
Bode Diagram
Frequency (rad/s)
-150
-100
-50
0
System: sysFrequency (rad/s): 1.26e+04Magnitude (dB): -3.05
Mag
nitu
de (d
B)
102
103
104
105
106
0
90
180
270
Phas
e (d
eg)
Bode Diagram
Frequency (rad/s)
-150
-100
-50
0
System: sysFrequency (rad/s): 1.26e+04Magnitude (dB): -3.05
System: sysFrequency (rad/s): 1.25e+03Magnitude (dB): -60.2
Mag
nitu
de (d
B)
The above MATLAB result shows the expected filtering characteristics as designed (note the angular frequency = 2*pi*f=2*3.14159*2K=12.56K. This cutoff frequency of the high-pass filter is illustrated in the Bode plot).
The above MATLAB result also shows the expected filtering characteristics as designed (note that for one decade, the slope on the Bode plot=-60 dB).
For the filter being designed, discuss the stability based on its characteristic roots and to s-domain pole-zero mapping.
The filter characteristic equation:
s3+25157 × s2+314465409 × s+1977770000000
>> num=[1 0 0 0];>> den=[1 25157, 314465409, 1977770000000];>> TF=tf(num, den);>> pzmap(TF); grid on
-14000 -12000 -10000 -8000 -6000 -4000 -2000 0-1.5
-1
-0.5
0
0.5
1
1.5x 10
4
0.360.480.62
0.78
0.94
2e+03
4e+03
6e+03
8e+03
1e+04
1.2e+04
1.4e+04
2e+03
4e+03
6e+03
8e+03
1e+04
1.2e+04
1.4e+04
0.080.160.260.360.480.62
0.78
0.94
0.080.160.26
Pole-Zero Map
Real Axis (seconds-1)
Imag
inar
y Ax
is (s
econ
ds-1
)
The characteristic roots:
>> R=roots([1 25157, 314465409, 1977770000000]);
R =
1.0e+04 *
-1.2657 -0.6250 + 1.0826i -0.6250 - 1.0826i
Because all real parts of the characteristic roots are in the left side of s-domain, the system is stable.
For the filter being designed, discuss the stability based on its step response in time-domain.
>> step(num, den), grid on
0 0.2 0.4 0.6 0.8 1 1.2
x 10-3
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1Step Response
Time (seconds)
Ampl
itude
The above time response shows a stable system.
Part 2:
Because
TF ( s)=V 0
V ¿= s3
s3+25157 × s2+314465409 × s+1977770000000
Let
TF ( s)=V 0
V ¿= s3
s3+a× s2+b×s+c
Perform the bilinear transformation (BLT)
s= 2T
× z−1z+1
Therefore,
TF ( z )=V 0
V ¿=¿¿
TF ( z )=V 0
V ¿=¿¿
Let fs=8000; T=1/8000=1.25e-4
TF:>> T=1.25e-4; a=25257; b=314465409;c=197777e7;fs=8000;>> num=[(2/T)^3, -3*(2/T)^3, +3*(2/T)^3, -(2/T)^3]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c)>> den=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c), (-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c)
num =
0.2331 -0.6993 0.6993 -0.2331
den =
1.0000 -0.4433 0.3827 -0.0389
Verify using MATLAB BLT command: format long
fs=8000;%sampling rate
B =[1 0 0 0];
A = [1 25157 314465409 197777e7];
[b a]=bilinear(B,A,fs);
>> freqz(num, den, 80000, fs), grid on
0 500 1000 1500 2000 2500 3000 3500 4000-400
-300
-200
-100
0
Frequency (Hz)
Pha
se (d
egre
es)
0 500 1000 1500 2000 2500 3000 3500 4000-300
-200
-100
0X: 1944Y: -1.215
Frequency (Hz)
Mag
nitu
de (d
B)
Verify using MATLAB BLT command: format long
fs=8000;%sampling rate
B =[1 0 0 0];
A = [1 25157 314465409 197777e7];
[b a]=bilinear(B,A,fs);
freqz(num, den, 80000, fs), grid on
b =0.233451389275327 -0.700354167825982 0.700354167825982
-0.233451389275327
a = 1.000000000000000 -0.442476756043099 0.384697309217583
-0.040437048941937
0 500 1000 1500 2000 2500 3000 3500 4000-400
-300
-200
-100
0
Frequency (Hz)
Pha
se (d
egre
es)
0 500 1000 1500 2000 2500 3000 3500 4000-300
-200
-100
0
Frequency (Hz)
Mag
nitu
de (d
B)
The filter zero-pole map:
>> T=1.25e-4; a=25257; b=314465409;c=197777e7;fs=8000;>> num=[(2/T)^3, -3*(2/T)^3, +3*(2/T)^3, -(2/T)^3]/ ((2/T)^3+a*(2/T)^2+b*(2/T)+c)>> den=[((2/T)^3+a*(2/T)^2+b*(2/T)+c), (-3*(2/T)^3-a*(2/T)^2+b*(2/T)+3*c),(3*(2/T)^3-a*(2/T)^2-b*(2/T)+3*c), (-(2/T)^3+a*(2/T)^2-b*(2/T)+c)]/((2/T)^3+a*(2/T)^2+b*(2/T)+c);zplane(num,den); grid on
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
3
Real Part
Imag
inar
y P
art
Because the magnitudes of all poles are within the unit circle, the system is stable.
To create a step response curve
>> format long
fs=8000;%sampling rate
B =[1 0 0 0];
A = [1 25157 314465409 197777e7];
[b a]=bilinear(B,A,fs);
>> stepz(b, a); grid on
0 2 4 6 8 10 12 14 16-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
n (samples)
Am
plitu
de
Step Response
Difference equation:
b =0.233451389275327 -0.700354167825982 0.700354167825982
-0.233451389275327
a = 1.000000000000000 -0.442476756043099 0.384697309217583
-0.040437048941937
>> y (n )−0.442476756043099∗y (n−1 )+0.384697309217583∗y ( n−2 )−0.040437048941937∗y (n−3 )=0.233451389275327∗x (n )−0.700354167825982∗x (n−1 )+0.700354167825982∗x(n−2)-0.233451389275327¿ x (n−3) ;
>> format long
fs=8000;%sampling rate
B =[1 0 0 0];
A = [1 25157 314465409 197777e7];
[b a]=bilinear(B,A,fs);
>> n = 0:18;[g2,x] = dstep(b,a,length(n)); %find g from difference equationstem(n,g2)title('Step response from difference equation'); grid on
0 2 4 6 8 10 12 14 16 18-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3Step response from difference equation
>> y (n )−0.442476756043099∗y (n−1 )+0.384697309217583∗y ( n−2 )−0.040437048941937∗y (n−3 )=0.233451389275327∗x (n )−0.700354167825982∗x (n−1 )+0.700354167825982∗x(n−2)-0.233451389275327¿ x (n−3) ;