Professional Documents
Culture Documents
BAB19 - Engineering Applications
BAB19 - Engineering Applications
Engineering Applications
The settings specified for the Idealized ADC Quantizer are noted in Figure 19.1. The output data
types for the Clock and the Idealized ADC Quantizer blocks are specified as double. The input
and output waveforms are shown in Figure 19.2.
Figure 19.2. Input and output waveforms for the model of Figure 19.1
191
Figure 19.3. Model producing a piecewise constant waveform when the sampling frequency is low
Figure 19.4. Input and output waveforms for the model of Figure 19.3
Whereas the ZeroOrder Hold circuit generates a continuous input signal u ( t ) by holding each
sample value u [ k ] constant over one sample period, a FirstOrder Hold circuit uses linear interpolation between samples as shown by the model of Figure 19.5 and the waveforms in Figure 19.6.
192
Figure 19.5. The model of Figure 19.2 with a FirstOrder Hold block
Figure 19.6. Input and output waveforms for the model of Figure 19.4
A comparison of the outputs produced by a Zero-Order Hold block and a First-Order Hold block
with the same input, is shown in the model of Figure 19.7. The outputs are shown in Figure 19.8.
Figure 19.7. Model for comparison of a Zero-Order Hold and a First-Order Hold blocks with same input
193
a2
a1
y[n]
a0
a 0 X ( z ) + a 1 z X ( z ) + a 2 z X ( z ) + ( b 1 )z Y ( z ) + ( b 2 )z Y ( z ) = Y ( z )
194
X ( z ) ( a0 + a1 z + a2 z ) = Y ( z ) ( 1 + b1 z + b2 z )
and thus the transfer function of the Direct Form I Realization of the secondorder digital filter of
Figure 19.9 is
1
a0 + a1 z + a2 z
( z )- = -------------------------------------------------H(z) = Y
1
2
X(z)
1 + b1 z + b2 z
(19.1)
A disadvantage of a Direct Form I Realization digital filter is that it requires 2k registers where k
represents the order of the filter. We observe that the secondorder ( k = 2 ) digital filter of Figure
11.9 requires 4 delay (register) elements denoted as z 1 . However, this form of realization has the
advantage that there is no possibility of internal filter overflow.*
b0
a1
y[n]
b1
z
b2
a2
The transfer function for the Direct FormII secondorder digital filter of Figure 19.10 is the same
as for a Direct FormI secondorder digital filter of Figure 19.9, that is,
1
a0 + a1 z + a2 z
H ( z ) = ---------------------------------------1
2
1 + b1 z + b2 z
(19.2)
A comparison of Figures 19.9 and 19.10 shows that whereas a Direct FormI secondorder digital
filter is requires 2k registers, where k represents the order of the filter, a Direct FormII second
order digital filter requires only k register elements denoted as z 1 . This is because the register
* For a detailed discussion on overflow conditions please refer to Digital Circuit Analysis and Design with an
Introduction to CPLDs and FPGAs, ISBN 0-9744239-6-3, Section 10.5, Chapter 10, Page 106.
The Direct Form-II is also known as the Canonical Form.
195
1 + 1.5z + 1.02z
H ( z ) = -------------------------------------------------1
2
1 0.25z + 0.75z
(19.3)
Figure 19.12. Input and output waveforms for the model of Figure 19.11
196
(19.4)
X(z)
HR ( z )
H2 ( z )
Y(z)
a1
x[n]
a2
y[n]
b1
b2
Figure 19.14. Series Form Realization of a second-order digital filter
The transfer function for the Series Form secondorder digital filter of Figure 19.14 is
1
1 + a1 z + a2 z
H ( z ) = --------------------------------------1
2
1 + b1 z + b 2 z
(19.5)
* The Series Form Realization is also known as the Cascade Form Realization
197
(19.6)
The model is shown in Figure 19.15, and the input and output waveforms are shown in Figure
19.16.
* The combination of the of factors in parentheses is immaterial. For instance, we can group the factors as
1
(----------------------------1 + 0.6z )
1
( 1 + 0.9z )
198
1
1
1
1 0.6z )( 1 + 0.6z )
( 1 0.6z )
--------------------------------------------------------and (---------------------------or
as
and
1
1
1
( 1 0.8z )
( 1 0.8z )
( 1 + 0.9z )
Figure 19.16. Input and output waveforms for the model of Figure 19.15
( 1 + 0.5z ) ( 1 + 1.7z + z )
H ( z ) = --------------------------------------------------------------------------1
1
2
( 1 + 0.1z ) ( 1 0.6 z + 0.9z )
(19.7)
199
H1 ( z )
X(z)
H2 ( z )
Y(z)
HR ( z )
As with the Series Form Realization, the ordering of the individual filters in Figure 19.17 is immaterial. But because of the presence of the constant K , we can simplify the transfer function
expression by performing partial fraction expansion after we express the transfer function in the
form H ( z ) z .
Figure 19.18 shows the Parallel Form Realization of a secondorder digital filter. The transfer
function for the Parallel Form secondorder digital filter of Figure 19.18 is
2
a1 + a2 z
H ( z ) = --------------------------------------1
2
1 + b1 z + b2 z
(19.8)
a1
a2
x[n]
y[n]
b1
b2
Figure 19.18. Parallel Form Realization of a second-order digital filter
1910
0.5 ( 1 0.36 z )
H ( z ) = -------------------------------------------1
2
1 + 0.1z 0.72 z
= 0.25
z=0
( z + 0.6 ) ( z 0.6 -)
------------------------------------------------r 2 = 0.5
z ( z 0.8 )
z = 0.9
z = 0.8
= 0.147
= 0.103
Therefore,
0.1030.147- + --------------H ( z -) = 0.25
---------- + ------------------------z + 0.9 z 0.8
z
z
0.147z 0.103z
H ( z ) = 0.25 + ---------------- + ---------------z + 0.9 z 0.8
0.147
0.103
H ( z ) = 0.25 + ----------------------- + ---------------------1
1
1 + 0.9z
z 0.8z
(19.9)
The model is shown in Figure 19.19, and the input and output waveforms are shown in Figure
19.20.
1911
Figure 19.20. Input and output waveforms for the model of Figure 19.19
1912
* For a detailed discussion on the analysis and design of binary counters, please refer to Digital Circuit Analysis
and Design with an Introduction to CPLDs and FPGAs, ISBN 0-9744239-6-3.
1913
1914
d
d
m -------2 x ( t ) + p ----- x ( t ) + kx ( t ) = F ( t )
dt
dt
(19.10)
where m represents the mass of the block, p is a positive constant of proportionality of the force
that the dashpot exerts on the block, and k is also a positive constant of proportionality of the
force that the spring exerts on the block, known as Hookes law.
x
Dashpot
Block
Mass m
Spring
1915
d
d
-------2 x ( t ) + 2 ----- x ( t ) + 3x ( t ) = ( 20 sin t )u 0 ( t )
dt
dt
(19.11)
where u 0 ( t ) is the unit step function, and the initial conditions are x ( 0 ) = 4 , and dx dt = 0 .
For convenience, we denote these are denoted as x10 and x20 respectively.
For the solution of (19.11) we will use the StateSpace block found in the Continuous Library,
and thus our model is as shown in Figure 19.26.
(19.12)
d
x 2 ( t ) = ----- x 1 ( t )
dt
(19.13)
and
Then,
2
d
d
d
----- x 2 ( t ) = -------2 x 1 ( t ) = -------2 x ( t )
dt
dt
dt
(19.14)
From (19.11), (19.13), and (19.14) we obtain the system of state equations
d---x ( t ) = x2 ( t )
dt 1
d
----- x 2 ( t ) = 3x 1 ( t ) 2x 2 ( t ) + ( 20 sin t )u 0 ( t )
dt
(19.15)
1916
(19.16)
or
y(t) = 1 0
x1 ( t )
x2 ( t )
Therefore, for the model of Figure 19.26, the coefficients A , B , C , and D are
A =
0 1
3 2
B =
0
5
C = 1 0
D = 0
(19.17)
The initial conditions x10 and x20 are denoted by the matrix
x10 =
x20
4
0
(19.18)
The values in (19.17) and (19.18) are entered in the Block parameters dialog box for the StateSpace block, and after the simulation command is issued, the Scope block displays the waveform
of Figure 19.27.
(19.19)
1917
X1
k1
f1
M1
k2
f2
M2
For simplicity, let us assume that the constants and conditions are such that after substitution into
(19.19), this relation reduces to
12
G ( s ) = ----------------------------------------------------------------4
3
2
s + 10s + 36s + 56s + 32
(19.20)
and the force applied at 50 sin t . The model under those conditions is shown in Figure 19.29, and
the input and output waveforms are shown in Figure 19.30.
Figure 19.30. Input and output waveforms for the model of Figure 19.29
1918
x
k
Block
Dashpot
Spring
Mass
M
Acceleration = a
It is shown in feedback and control systems textbooks that the transfer function G ( s ) = x a is
1
G ( s ) = -------------------------------------------------2
s + (D M)s + k M
(19.21)
For simplicity, let us assume that the constants and conditions are such that after substitution into
(19.21), this relation reduces to
1
G ( s ) = ---------------------------------2
s + 0.1s + 0.2
(19.22)
and the force applied is 0.8u 0 ( t ) where u 0 ( t ) is the unit step function. The model under those
conditions is shown in Figure 19.32, and the input and output waveforms are shown in Figure
19.33.
1919
Figure 19.33. Input and output waveforms for the model of Figure 19.32
1---------s+a
1
----------s+b
Controller
Plant
In Figure 19.34, the Controller and Plant blocks are in series and according to Feedback and Control Systems theory, can be replace by a single block whose transfer function is their product as
shown in Figure 19.35.
1920
1
--------------------------------(s + a)(s + b)
or
1
1
Y + ------------------------------- Y = ------------------------------- X
(s + a )(s + b)
(s + a)(s + b)
(s + a )(s + b)
1
1
Y ------------------------------- + ------------------------------- Y = ------------------------------- X
(s + a )(s + b) (s + a )(s + b)
(s + a )(s + b)
and thus
Y
1
G ( s ) = ---- = ---------------------------------------X
(s + a)(s + b) + 1
Therefore, the block diagram of Figure 19.34can be replaced with only one block in an openloop
form as shown in Figure 19.36.
1
------------------------------------------( s + a )( s + b) + 1
A feedback control system in the form of the feedback path shown as in Figure 19.37 is referred to
as a feedback control system in canonical form. For the system of Figure 19.37, the ratio Y X is
Y
G
---- = -----------------X
1 GH
X
+
+ R
(19.23)
Y
1921
0.5
-----------4
s +4
+
+
1---------s+1
G1
H2
4
----------s+2
G2
7 ------------2
s +3
G3
+
+
+
3s + 5
----------------3
s + 15
H1
2s + 1
-------------------------2
s + 3s + 2
G4
G1 G2 G3 + G4 G1 G2 G4 H1 + G2 G4 H1 + G2 G3 G4 H2
----------------------------------------------------------------------------------------------------------------------1 G1 G2 H1 + G2 H1 + G2 G3 H2
Figure 19.39. Open-loop equivalent control system for the closedloop system of Figure 19.38
We can prove that the systems of Figures 19.37 and 19.38 are equivalent with Simulink blocks.
The system of Figure 19.38 is represented by the model in Figure 19.40 and there is no need to
represent it as an openloop equivalent. Instead, we can represent it as the subsystem shown in
Figure 19.41.
1922
85
170 0 V
j100
IX
100
50
j200
j10.6
X
100
VTH = 110j6.87 V
Figure 19.43. The circuit of Figure 19.42 replaced by its Thevenin equivalent
* A phasor is a rotating vector. Phasors are used extensively in the analysis of AC electric circuits. For a thorough
discussion on phasors, please refer to Circuit Analysis I with MATLAB Applications, ISBN 0-9709511-2-4.
For a step-by-step procedure, please see same reference.
1923
(19.24)
Now, we use the model of Figure 19.44 to convert all quantities from the rectangular to the polar
form, perform the addition and multiplication operations, display the output voltage in both polar
and rectangular forms, and show the output voltage on a Scope block in Figure 19.45. The Simulink blocks used for the conversions are in the Math Operations library.
Figure 19.44. Model for the computation and display of the output voltage for the circuit of Figure 19.43
Figure 19.45. Waveform for the output voltage of model of Figure 19.44
1924
5 0 A
R1
j 6
C1
R2
j3
R3
8
j 3
10 0 A
C2
Let the phasor voltage across C 2 due to the 5 0 A current source acting alone be denoted as
V ' C2 , and that due to the 10 0 A current source as V '' C2 . Then, by the superposition principle,
V C2 = V ' C2 + V '' C2
With the 5 0 A current source acting alone, the circuit reduces to that shown in Figure 19.47.
5 0 A
4
j 6
R2
j3
R1
C1
R3
j 3
V ' C2
C2
Figure 19.47. Circuit of Figure 7.45 with the 5 0 A current source acting alone
Next, with the 10 0 A current source acting alone, the circuit reduces to that shown in Figure
19.48.
1925
4
j 6
R2
j3
R1
C1
8
j 3
R3
10 0 A
V '' C2
C2
and by application of the current division expression, the current I '' C2 through C 2 is
4 j6 + 2 + j3
I '' C2 = ------------------------------------------------------- ( 10 0 )
4 j6 + 2 + j3 + 8 j3
6.708 26.6
= ------------------------------------- 10 180 = 4.404 176.6
15.232 23.2
or
V C2 = 3.094 + j7.240 = 7.873 113.1
The models for the computation of V ' C2 and V '' C2 are shown in Figures 19.49 and 19.50 respectively.
1926
Transformations
The final step is to add V ' C2 with V '' C2 . This addition is performed by the model of Figure 19.51
where the models of Figures 19.49 and 19.50 have been converted to Subsystems 1 and 2 respectively.
The model of Figure 19.51 can now be used with the circuit of Figure 19.46 for any values of the
impedances Z .
19.8 Transformations
The conversions from complex to magnitudeangle and magnitudeangle to complex used in the
previous section, can also be performed with the Cartesian to Polar and Polar to Cartesian blocks.
Examples are presented in the model of Figure 19.52 where transformations from Cartesian to
Spherical and Spherical to Cartesian are shown. The equations used in these transformations are
shown in the Block Parameters dialog box for each block.
1927
dV F1
------------ = 0.33 log 10 ( I ff I fv ) 1.66
dT
We begin with the userdefined mfile below which we type in the Editor Window and we save it
as diode.m
function dx=diode(t,x,Ifv)
%
% Model for gold-doped and non-gold-doped diodes
%
Vf1 = x(1); % Gold-doped diode forward voltage, volts
Vf2 = x(2); % Non-gold-doped diode forward voltage, volts
1928
of forward current in mA
dVf1 = 0.6*log10(Iff)-1.92;
dVf2 = 0.33*log10(Iff-Ifv)-1.66; % Ifv = variable value of forward current in mA
dx = [dVf1;dVf2];
To test this function for correctness, on MATLABs Command Window we type and execute the
command
[t,x,Ifw]=ode45(@diode, [0 10], [1;10],[ ], 50)
where the vector [0 10] specifies the start and the end of the simulation time, the vector [1;10]
specifies an initial value column vector, the null vector [ ] can be used for other options, and the
input value is set to 50.
Next, using the Editor Window we write the mfile below and we save it as diode_sfcn.m
function [sys,x0,str,ts]=...
diode_sfcn(t,x,u,flag,Vf1init,Vf2init)
switch flag
case 0
% Initialize
str = [];
ts = [0 0];
s = simsizes;
s.NumContStates = 2;
s.NumDiscStates = 0;
s.NumOutputs = 2;
s.NumInputs = 1;
s.DirFeedthrough = 0;
s.NumSampleTimes = 1;
sys =simsizes(s);
x0 = [Vf1init,Vf2init];
case 1
% Derivatives
Ifw = u
sys = diode(t,x,Ifw);
case 3
% Output
sys = x;
case {2 4 9}
sys = [];
% 2:discrete
% 3:calcTimeHit
% 9:termination
otherwise
1929
The syntax for the diode_sfcn.m file above is the same as that of Example 11.14, Chapter 11,
Page 1144.
Next, we open a new model window, from the UserDefined Functions Library we drag an S
Function block into it, we doubleclick this block, in the Function Block Parameters dialog box
we name it diode_sfcn, and we add and interconnect the other blocks shown in Figure 19.53.
The waveforms displayed by the Scope 1 and Scope 2 blocks are shown in Figures 19.54 and 19.55
respectively.
Figure 19.54. Waveform displayed by the Scope 1 block in the model of Figure 19.53
1930
Concluding Remarks
Figure 19.55. Waveform displayed by the Scope 2 block in the model of Figure 19.53
1931
1932