Sunteți pe pagina 1din 36

Appendix B

MATLAB Aidcd Control


Systcm Dcsign: Convcntional
Control theory, at the introductory level, deals primarily with linear time-invari-
ant systems. Few real systems are exactly linear over their whole operating
range, and Iew systems have parameter values that are precisely constant
Iorever. But many systems approximately satisIy these conditions over a
suIIiciently narrow operating range. Our Iocus here is on a design procedure
which is applicable to linear time-invariant systems.
Control system design begins with a proposed plant or process whose
satisIactory dynamic perIormance depends on Ieedback Ior stability, distur-
bance regulation, tracking accuracy or reduction oI the eIIects oI parameter
variations. We give here an outline oI the design process that is general enough
to be useIul whether the plant is an electronic ampliIier or a large structure to
be placed in earth orbit. Obviously, to be widely applicable, our outline has to
be vague with respect to physical details and speciIic only with respect to
Ieedback-control problems.
To present our outline, we divide the control design problem into a sequence
oI characteristic steps. This sequence oI steps is an approximation oI good
design practice; there will certainly be variations in the sequence depending
upon the problem in hand. In some cases, we may carry out the steps in a
diIIerent order; in others, we may omit a step or add one. Also, the design
methods covered in our sequence oI steps are not the only methods available in
control engineer`s toolbox. There are other powerIul methods available in the
literature. Our selection in the outline is based on the design methods covered in
the present text.
This appendix also provides guidance to the reader to integrate the learning
oI control system analysis and design material with the learning oI how one
computes the answers with MATLAB soItware package. The appendix is not
meant to be a substitute Ior the MATLAB soItware manuals; rather, it will help
igiral Conrrol and Srarc \ariallc Mcrhods 87
guide the reader to the appropriate place in the manuals Ior speciIic calcula-
tions. The manuals are the best source oI learning the package; our attempt
here is only to expedite the process oI making Iull use oI the power oI the
package Ior control system design problems.
The MATLAB statements/responses given in this appendix are Irom
MATLAB version 6 and Control System Toolbox version 5, on the Windows
platIorm. ReIer |180| Ior an introduction to the MATLAB environment.
A sequence oI characteristic steps oI MATLAB-aided control system design
Iollows.
1. Me|c e systcm m4c/
When a control engineer is given a control problem, oIten one oI the Iirst tasks
that he undertakes is the development oI the mathematical model oI the process
to be controlled, in order to gain a clear understanding oI the problem.
Basically, there are only a Iew ways to actually generate the model. We can use
the Iirst principles oI physics to write down a model. Another way is to
perIorm 'system identiIication via the use oI real plant data to produce a
model oI the system. Sometimes, a combined approach is used where we use
physics to write down a general diIIerential equation we believe represents
plant behaviour, and then we perIorm experiments on the plant to determine
certain model parameters or Iunctions.
For time-invariant systems, mathematical model building based on physical
laws normally results in a set oI diIIerential equations. These equations, when
rearranged as a set oI Iirst-order diIIerential equations, result in a state-space
model oI the Iollowing Iorm:
x f (x, u)
(B.1)
y h(x, u)
where f() and h() are nonlinear Iunctions oI their arguments; x(t) is the n 1
internal state vector, u(t) is the p 1 control input vector, and y(t) is the q 1
measured output vector. Overdot represents diIIerentiation with respect to
time t. The Iirst equation, called the state equation, captures the dynamical
portion oI the system and has memory inherent in the n integrators. The second
equation, called the output or measurement equation, represents how we chose
to measure the system variables; it depends on the type and availability oI
sensors.
Model-building and its validation will require simulation oI the model. The
nonlinear state-space equations oI the Iorm (B.1) are very easy to simulate on a
digital computer. MATLAB provides many Runge-Kutta numerical integration
routines Ior solving ordinary diIIerential equations; the Iunction ode23 usually
suIIIices Ior our applications. Use oI ode23 Iunction Ior solving
ordinary diIIerential equations oI the type (B.1) will be demonstrated later.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 877
2. Dctcrminc thc rcquirc4 pcrjrmencc spccijicetins
This step requires an understanding oI the process: what it is intended to do,
how much error is permissible, how to describe the class oI command and
disturbance signals to be expected, what the physical capabilities and limita-
tions are, etc. A control system normally operates in one oI the two Iashions:
(i) The system is designed to regulate the output at a Iixed level prescribed
by a constant input (called the set-point) in the Iace oI uncertainties in
the plant behaviour and environmental disturbances to the plant.
(ii) The system is designed to drive the output to track a changing input in
the Iace oI uncertainties in the plant behaviour and environmental distur-
bances to the plant. A system will be required to Iollow in practice a
Iamily oI tracking Iunctions.
As the nature oI the transient response oI a control system is dependent upon
the system poles only and not on the type oI the input, it is suIIicient to analyse
the transient response to one oI the standard test signals; a step is generally
used Ior this purpose.
In speciIying the steady-state response characteristics, it is common to
speciIy the steady-state error oI the system to one or more oI the standard test
signalsstep, ramp and parabola. Theoretically, it is desirable Ior a control
system to have the capability oI responding with zero error to all the polynomial
inputs oI degree k : r(t) (t
k
/k!); t 0, k 0, 1, 2, . The higher the value oI
k, the more stringent is the steady-state requirement, making it diIIicult to
satisIy other speciIications on the perIormance oI the system. It is thereIore
necessary that tracking commands which a control system is expected to be
subjected to, be careIully examined and steady-state speciIications be Iormu-
lated Ior inputs with minimum possible value oI k.
Typical results oI the second step in the design process are speciIications
that the system have (when subjected to command/disturbance inputs)
(i) a step response inside some constraint boundariesspeciIied by rise
time, settling time, peak overshoot, etc.; and
(ii) steady-state error to step/ramp/parabolic input within prescribed limits
under the constraints imposed by physical limitations oI the selected
plant, actuator, and sensor.
Another standard test signal oI great importance is the sinusoidal signal: a
sinusoidal Iunction with variable Irequency is used as input Iunction; input
Irequency is swept Irom zero to beyond the signiIicant range oI system
characteristics. Curves in terms oI amplitude ratio and phase between input and
output as a Iunction oI Irequency, display the Irequency response oI the sys-
tem.
Requirements that a system have a step response inside some constraint
boundariesspeciIied by rise time, settling time, peak overshoot, etc., can
equivalently be represented as requirements that the system have a Irequency
response satisIying certain constraintsspeciIied by gain margin, phase mar-
gin, bandwidth, etc.
igiral Conrrol and Srarc \ariallc Mcrhods 878
3. Me|c e /incer m4c/
From the speciIications, identiIy the equilibrium point oI interest and construct
a small-signal dynamic model. Validate the model with experimental data where
possible. Regrettably, we have a tendency to view the process as a linear
time-invariant model, capable oI responding to inputs oI arbitrary size, and we
tend to overlook the Iact that the linear model is a very limited representation oI
the system, valid only Ior small signals, short times, and particular environ-
mental conditions. We should not conIuse the approximation with reality. We
must be able to use the simpliIied model Ior the intended purpose and to return
to an accurate model or the actual physical system to really veriIy the design
perIormance.
Linearization oI equations oI the Iorm (B.1) leads to a model oI the Iorm
given below:
x Ax Bu
y Cx Du
(B.2)
The n 1 vector x is the state oI the system, A is the constant n n system
matrix, B is the constant n p input matrix, C is the constant q n output
matrix, and D is the constant q p matrix.
While considering only single-input, single-output (SISO) problems, we take
number oI inputs, p, and the number oI outputs, q, to be one. For SISO prob-
lems, the state variable model may be expressed as
x Ax bu
(B.3)
y cx du
Note that matrices B, C, and D oI the MIMO (multi-input, multi-output)
representation now become vectors b and c, and scalar d respectively; and the
input vector u and output vector y oI the MIMO representation now become
scalar variables u and v respectively.
Validation oI the linear model with experimental data or simulation data
obtained Irom (B.1) will require simulation oI Eqns (B.2)/(B.3). MATLAB
provides many Iunctions Ior simulation oI linear models. We consider here
some Iunctions important Irom the control-engineering perspective.
For the state-space representation (B.2)/(B.3), the data Ior the model
consists oI Iour matrices. For convenience, the MATLAB provides customized
data structure (LTI object). This is called the SS object. This object encapsu-
lates the model data and enables you to manipulate the LTI system as a single
entity, rather than as a collection oI data vectors and matrices.
An LTI object oI the type SS is created whenever you invoke the construc-
tion Iunction ss.
sys ss(A, B, C, D) (B.4)
creates the state-space model (B.2).
When the Iour matrices oI the model (B.3) are entered,
sys ss(A, b, c,d) (B.5)
creates a state-space model Ior SISO systems.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 87
For model sys in (B.5), step(sys) will generate a plot oI unit-step response
v(t) (with zero initial conditions). The time vector is automatically selected
when t is not explicitly included in the step command.
II you wish to supply the time vector t at which the response will be com-
puted, the Iollowing command is used.
step(sys,t)
You can speciIy either a Iinal time t Tfinal or a vector oI evenly spaced
time samples oI the Iorm
t 0: dt : Tfinal
When invoked with leIt-hand arguments such as
y,t] step(sys)
y,t,X] step(sys)
y step(sys,t)
no plot is generated on the screen. Hence it is necessary to use a plot command
to see the response curves. The vector y and matrix X contain the output and
state response oI the system respectively, evaluated at the computation points
returned in the time vector t (X has as many columns as states and one row Ior
each element in vector t).
Other time-response Iunctions oI interest to us are
impulse(sys) impulse response
initial(sys,x0) free response to initial state vector x0
Isim(sys,u,t) response to input time history in vector u
Isim(sys,u,t,x0) having length (t) rows
For MIMO models (B.4), these Iunctions produce an array oI plots.
4. Me|c e 4csin m4c/
Complex processes and machines oIten have several variables (outputs) that
we wish to control, and several manipulated inputs are available to provide this
control. In many situations, one input aIIects primarily one output and has only
a weak eIIect on other outputs; it becomes possible to ignore weak interactions
(coupling) and design controllers under the assumption that one input aIIects
only one output. Input-output pairing, to minimize the eIIect oI interactions and
application oI SISO control schemes to obtain separate controllers Ior
each input-output pair, results in an acceptable perIormance. This, in Iact,
amounts to considering the multivariable system as consisting oI an appropriate
number oI separate SISO systems. Coupling eIIects are considered as
disturbances to the separate control systems. We will limit our discussion to
SISO design models.
igiral Conrrol and Srarc \ariallc Mcrhods 880
Depending on the type oI model you use, the data Ior your model may
consist oI a simple numerator/denominator pair Ior transIer Iunctions or Iour
matrices Ior state-space models. MATLAB provides LTI objects TF and SS Ior
transIer Iunctions and state-space models respectively. We have already
discussed the creation oI LTI object oI the type SS.
An LTI object oI the type TF is created whenever you invoke the construc-
tion Iunction tf.
sys tf(num,den) (B.6)
num and den vectors speciIy n(s) and d(s) respectively, oI the transIer
Iunction G(s) n(s)/d(s).
MATLAB has the means to perIorm model conversions. Given the SS model
sys_ss, the syntax Ior conversion to TF model is
sys_tf tf(sys_ss)
Common pole-zero Iactors oI G(s) must be cancelled beIore we can claim
that we have the transIer Iunction representation oI the system. To assist us in
pole-zero cancellation, MATLAB provides minreal Iunction.
sysr minreal(sys_tf)
Given the TF model sys_tf, the syntax Ior conversion to SS model is
sys_ss ss(sys_tf)
MATLAB provides many Iunctions Ior simulation oI transIer Iunctions. For
the transIer Iunction model sys tf(num,den), step(sys) will generate a plot
oI unit-step response v(t) Irom the transIer Iunction
Y s
U s
( )
( )
G(s)
num
den
The time vector is automatically selected when t is not explicitly included in
the step command. II you wish to supply the time vector t at which the
response will be computed, the Iollowing command is used.
step(sys,t)
When invoked with leIt-hand arguments such as
y,t] step(sys)
y step(sys,t)
no plot is generated on the screen. Hence, it is necessary to use a plot
command to see the response curve. The vector y has one column and one row
Ior each element in time vector t.
Other time-response Iunctions oI interest to us are
impulse(sys) imulse response
Isim(sys,u,t) response to input time history in
vector u having length (t) rows.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 881
Select sensor and actuator and construct a design model Ior the Ieedback
system. Process transIer Iunction models Irequently have deadtime (input-
output delay). TF object Ior transIer Iunctions with deadtime can be created
using the syntax
sys tf(num,den,InputDelay`, value)
5. Discrctiec thc 4csin m4c/
Various Iorms oI devices have been used Ior mechanization oI industrial
automatic controllers. Electronic controllers (based on op amp circuits) and
computer-based controllers are commonly used in industrual applications.
Opting Ior computer-based controllers leads to two design alternatives.
(i) Design using emulation. The design is done in the continuous-time do-
main totally ignoring the Iact that a sampler and a digital computer will
eventually be used. Having the continuous-time controller, we then con-
vert the design to a digital control.
This method produces a good controller Ior the case when the sampling
rate is about 30 times Iaster than the bandwidth, but produces a control-
ler needing Iurther reIinement Ior the case when the sampling rate is
about 6 times the bandwidth. For a sampling period oI T sec, sample-
and-hold introduce a time delay oI approximately T/2 sec.
A method that has been Irequently used by practising engineers is based
on approximation oI sampled-data system by a continuous-time system
that includes the transIer Iunction e
sT/2
in the Iorward path in cascade
with the plant transIer Iunction G(s). An analog controller D(s) is then
designed Ior the plant G(s)e
sT/2
; this design is then converted to a digital
control.
Carrying out the initial design using continuous-time methods is a good
idea, independent oI whether it will be used in a subsequent emulation
step or merely as a guide Ior direct digital design. Knowing how the
system could perIorm iI implemented with analog hardware provides a
target Ior how well the digital system should perIorm, and helps in
selecting the sampling rate.
(ii) Direct digital design. The other alternative is to design the controller
directly in discrete-time domain. At the outset, the plant model is trans-
Iormed into a discrete-time system and the design iterations to achieve
the desired system perIormance are carried out in discrete-time domain.
By carrying out the digitization on the plant model, instead oI on continu-
ous-time controller as was done Ior the emulation design method, the
approximate nature oI the process can be eliminated. This is so
because the actual plant must be preceded by a hold (usually a zero-
order hold) and, thereIore, has an exact discrete equivalent that includes
the lagging eIIect oI the hold. The impact oI using an exact discrete
equivalent oI the plant is that a digital controller Iound using direct digital
design methods may yield perIormance close to the desired speciIica-
tions Ior slow sample rates.
igiral Conrrol and Srarc \ariallc Mcrhods 882
There are various standard methods Ior discretization oI continuous-time
models. None oI these methods is exact Ior all types oI input because no
sampled system has access to the input time history between samples. In
essence, each approximation makes a diIIerent assumption about what the
continuous input is doing between samples. MATLAB soItware has Iunctions
that allow use oI various approximations. We consider here couple oI Iunctions
important Irom control-engineering perspective.
State-space model oI a discrete-time SISO system is oI the Iorm
x(k 1) Fx(k) gu(k)
v(k) cx(k) du(k)
Construction oI the SS object Ior this discrete-time model requires Iour
matrices F, g, c and d, and the sampling interval T.
sysd ss(F,g,c,d,T`)
TransIer Iunction model oI a discrete-time SISO system is oI the Iorm
G(:)
n :
d :
( )
( )

num
den
Construction oI the TF object Ior this discrete-time model requires num and den
polynomials in :, and the sampling interval T.
sysd tf(num, den,T`)
For a continuous-time model sysc, the command
sysd c2d(sysc,T) T is sampling period in seconds
perIorms ZOH conversion by deIault.
sysc is continuous-time state-space system (B.3) and sysd is the discrete-
time system
x(k 1) Fx(k) gu(k)
v(k) cx(k) du(k)
assuming a zero-order hold on the inputthe control input is assumed
piecewise constant over the sample time T.
F,g,c,d] ssdata(sysd)
c2d can also be used with transIer Iunction models. Continuous-time system
sysc representing
G(s)
num
den
gets converted to the discrete-time system sysd, representing
G
h0
G(:)
num:
den:
numd,dend] tfdata(sysd,v`)
returns numerator and denominator oI transIer Iunction as row vectors.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 883
To use alternative conversion schemes, speciIy the method
sysd c2d(sysc,T,tustin`) Use Tustin approximation
The Iunction c2d(sysc,T,tustin`) converts a continuous-time system to dis-
crete-time system using trapezoidal rule Ior integration, also called the bilinear
transIormation. (The Iunction d2c is an inverse operationit converts dis-
crete-time models to continuous-time Iorm).
MATLAB provides many Iunctions Ior simulation oI discrete-time systems.
step(sys) will generate a plot oI unit-step response v(k) oI the discrete-time
system (transIer Iunction model or state-space model) sys. Zero initial state is
assumed iI sys represents a state-space model. The number oI sample points is
automatically determined when time is not explicitly included in the command.
II you wish to supply the sample points vector k at which the response will
be computed, the Iollowing command is used.
step(sys,t)
You can speciIy t as a vector oI sample points:
t 0:T:tfinal
When invoked with leIt-hand arguments, no plot is generated on the screen; it
is necessary to use a plot command to see the response curves.
Other time-response Iunctions oI interest to us are
impulse(sys) impulse response
initial(sys,x0) free response to initial state vector x0
Isim(sys,u,t) response to input time history in
Isim(sys,u,t,x0) vector u having length (t) rows
You can analyze the time response using the LTI Viewer, which is a graphical
user interIace Ior viewing and manipulating response plots oI LTI models. For
example
Itiview(step`,sys)
will open a window displaying the step response oI the LTI model sys. Once
initialized, the LTI Viewer assists you with the analysis oI the response by
Iacilitating such Iunctions as zooming into regions oI the response plots,
calculating response characteristics such as peak response, settling time, rise
time, steady-state, toggling the grid on or oII the plot, and many other useIul
Ieatures.
. 1ry e simp/c /e-/ce4 4csin
To Iorm an initial estimate oI the complexity oI the design problem, sketch
Irequency response plot (Bode plot) and root-locus plot with respect to plant
gain. Try to meet the speciIications with a simple controller oI lag-lead
variety. Do not overlook IeedIorward oI the disturbances iI the necessary sen-
sor inIormation is available. Consider the eIIect oI sensor noise, and compare a
igiral Conrrol and Srarc \ariallc Mcrhods 884
lead network in the Iorward path to minor-loop Ieedback structure having
direct Ieedback Irom velocity sensor, to see which gives a better design.
For design by root-locus method, the design speciIications are translated
into desired dominant closed-loop poles. Other closed-loop poles are required
to be located at a large distance Irom the fw-axis. It may be noted that pole-
placement methods do not allow the designer to judge how close the system
perIormance is to the best possible. Also, there is lack oI visibility into
low-Irequency disturbance rejection. This can cause many problems: the
disturbance rejection may not be optimized, and the plant-parameter variations
may cause large closed-loop response variations. Stability margins on Nyquist/
Bode plots give a better robustness measure. For this reason, though the speci-
Iications on the closed-loop perIormance are oIten Iormulated in time domain,
it is worthwhile to convert them into Irequency-domain speciIications and then
design the compensator with Irequency-domain methods. Root-locus plots are
very impressive analysis tools Ior systems that have been designed by
Irequency-domain methods. For example, these plots can be valuable Ior the
analysis oI the eIIects oI certain parameter variations on stability.
Note that the above comments reIlect the opinion oI practising engineers.
Teaching in universities relies heavily on both the methods; our textbook also
Iollows the standard pattern.
The Iunction bode(sys) generates the Bode Irequency-response plot Ior LTI
model sys. This Iunction automatically selects the Irequency values by placing
more points in regions where the Irequency response is changing quickly. This
range is user-selectable utilizing the logspace Iunction. When invoked with
leIt-hand arguments,
mag,phase,w] bode(sys)
mag,phase] bode(sys,w)
return the magnitude and phase oI the Irequency response at the Irequencies w.
The Iunction margin determines gain margin, phase margin, gain crossover
Irequency and phase crossover Irequency.
The Iunction bode handles both continuous-time and discrete-time models.
For continuous-time models, it computes the Irequency response by evaluating
the transIer Iunction G(s) on the imaginary axis s fw. For discrete-time
models, the Irequency response is obtained by evaluating the transIer Iunction
G
h0
G(:) on the unit circle : e
fwT
; where T is the sample time.
mag(w) ,G
h0
G(e
fwT
),
phase(w) G
h0
G(e
fwT
)
These magnitude and phase relationship make useless the hand-plotting proce-
dures developed by Bode. Also the ease with which a designer can predict the
eIIect oI pole and zero changes on the Irequency response is lost.
The w-transIorm approach was developed so that Bode-plots plotting and
interpretation are almost as easy Ior discrete-time systems as they are Ior
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 885
continuous-time ones. ThereIore, in practice, Irequency-response design oI
systems using a discrete-time model is oIten carried out using the
w-transIormation; however, the need to replace the :-plane with the w-plane is
less obvious in today`s environment where good soItware tools are universally
available Ior the designer to perIorm the plotting. The essential idea oI this
method is to retain many design Ieatures Irom the continuous-time systems.
The discrete-time model oI the plant G
h0
G(:) num/den is transIormed with
bilinear mapping using the MATLAB Iunction d2c. Construction oI discrete-
time model requires numerator polynomial num in :, denominator polynomial
den in : and value oI the sampling interval T.
sysd tf(num,den,T`)
Conversion to w-domain is given by
sysw d2c(sysd,tustin`)
The Nichols Irequency-response plot can be generated using nichols
Iunction; the Irequency range is user-selectable. A Nichols chart grid is drawn
on the existing plot with the ngird Iunction. These Iunctions are applicable to
both continuous-time and discrete-time systems.
You can analyze the Irequency response using the LTI Viewer, which is a
graphical user interIace Ior viewing and manipulating response plots oI LTI
models. For example,
Itiview(nichols`,sys)
will open a window displaying the Nichols plot oI the LTI system sys. Once
initialized, the LTI Viewer assists you with the analysis oI the response by
Iacilitating such Iunctions as zooming into regions oI response plot; calculating
response characteristics such as resonance peak, resonance Irequency, band-
width, stability margins, and many other useIul Ieatures.
MATLAB Iunction rlocus(sys) calculates and plots the root locus oI the
open-loop SISO model sys. II sys has transIer Iunction
G(s)
n s
d s
( )
( )
rlocus adaptively selects a set oI positive gains K and produces a smooth plot
oI the roots oI
d(s) Kn(s) 0
Alternatively, rlocus(sys,K) uses the user-speciIied vector K oI gains to
plot the root locus.
The Iunction rlocfind returns the Ieedback gain associated with a particular
set oI poles on the root locus. K,poles] rlocfind(sys) is used Ior
interactive gain selection. The Iunction rlocfind puts up a crosshair cursor on
the root locus plot that you use to select a particular pole location. The root
locus gain associated with this point is returned in K and the column vector
poles contains the closed-loop poles Ior this gain. To use this command, the
root locus must be present in the current Iigure window.
igiral Conrrol and Srarc \ariallc Mcrhods 88
The Iunctions rlocus and rlocfind work with both the continuous-time and
discrete-time SISO systems. The Iunctions sgrid/spchart and zgrid/zpchart
are used Ior w
n
and z grid on continuous-time and discrete-time root locus,
respectively.
You can design a compensator using the SISO Design tool, which is a
Graphical User InterIace (GUI). To initialize this GUI, type
sisotool(sys)
7. 1ry stetc-specc 4csin
Choices in the design methods are a design variable in the whole process. Many
a times, the choice oI a design method depends upon our selection oI the
sensed quantities to be used Ior Ieedback. II we decide to sense and Ieedback
only the output, then the trial-and-error lead-lag type design methods is a good
choice. However, iI these compensators do not give entirely satisIactory per-
Iormance, we may attempt to install sensors Ior all the state variables and
consider design methods requiring Iull state Ieedback.
The approach we may take at this point is pole placement; that is, having
picked a state-Ieedback control law with enough parameters to inIluence all the
closed-loop poles, we will arbitrarily select the desired pole locations oI the
closed-loop system and see iI the approach gives satisIactory perIormance as
speciIied in Step 2.
OI course, used without thought, the method oI pole placement can also
result in a design that requires unreasonable levels oI control eIIort, or is very
sensitive to changes in plant model. In Iact, there is no trial-and-error involved
in calculating the parameters oI state-Ieedback control law Ior a given set oI
desired closed-loop poles. The trial-and-error in the pole-placement design
process is in selecting the closed-loop pole locations that meet the perIormance
speciIications oI Step 2 under the constraints imposed on plant, actuator and
sensors.
The optimal design method can also be used to design a state-Ieedback
control law. It is based on minimizing a cost Iunction that consists oI the
weighted sum oI squares oI the state errors and control. The relative
weightings between the state variables and control are varied by the designer in
order to meet all the system speciIications oI Step 2.
We use a state estimator to implement state-Ieedback control law when all
the states cannot be sensed using hardware sensors. The state estimator is a
soItware sensor. We select the closed-loop estimator error poles to be about
eight times Iaster than the control poles. The reason Ior this is to keep the
error-poles Irom reducing the robustness oI the design; a Iast estimator will
have almost the same eIIect on the response as no estimator at all.
II we opt Ior optimal design method Ior the estimator, the relative weightings
in the cost Iunction are properly selected to meet the requirements oI Iast
estimation.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 887
Controllability and observability oI a system in state variable Iorm can be
checked using the MATLAB Iunctions ctrb and obsv, respectively. The inputs
to be ctrb Iunction are the system matrix A and the input matrix b; the output
oI ctrb Iunction is the controllability matrix U. Similarly, the inputs to the obsv
Iunction are the system matrix A and the output matrix c; the output is observ-
ability matrix V. The Iunction rank gives the controllability and observability
properties.
Pole-placement design may be carried out using the MATLAB Iunction
acker. However, the computation oI the controllability matrix has very poor
numerical accuracy and this carries over to Ackermann`s Iormula. The
Iunction acker can be used Ior the design oI SISO systems with a small
( 5) number oI state variables. For more complex cases a more reliable
Iormula is available, implemented in MATLAB with the Iunction place.
A modest limitation on place is that none oI the desired closed-loop poles may
be repeated, that is, the poles must be distinct; a requirement that does not
apply to acker.
The MATLAB Iunction lyap solves Lyapunov matrix equation. The
solution to discrete matrix Lyapunov equation is Iound with dlyap. The Iunc-
tion lqr solves the linear quadratic regulator problem and associated Riccati
equation. Discrete linear quadratic regulator design is carried out using the
Iunction dlqr.
8. Cmputc e 4iite/ cquive/cnt j thc ene/ cntr//cr
AIter reaching the best compromise on controller design choice, the next step
is to build a computer model, and compute (simulate) the perIormance oI the
design. At this stage, we are required to compute a digital equivalent oI the
analog controller. This allows the Iinal design to be implemented using digital
processor logic.
Given the analog controller
D(s) num/den
the Iollowing commands give the discrete equivalent
D(:) num: /den:
oI the controller, with T as the sampling period.
sysc tf(num,den)
sysd c2d(sysc,T,tustin`)
. Simu/etc thc pcrjrmencc j thc 4csin
AIter reaching the best compromise among process modiIication, actuator and
sensor selection, and controller design choice, run a computer model oI the
system. This model should include important nonlinearitiessuch as actuator
saturation, and the parameter variations you expect to Iind during operation oI
the system. The simulation will conIirm stability and robustness and allow you
to predict the true perIormance you can expect Irom the system.
igiral Conrrol and Srarc \ariallc Mcrhods 888
To use the MATLAB numerical integration routines, the system dynamics
must be written into an M-file. The state-space description makes this very
direct; in Iact, ordinary diIIerential equation solver Iunction ode23 requires the
dynamics in state-space Iorm (B.1).
As an example, consider van der Pol oscillator which has dynamics
v a(v
2
1) v v u
DeIining the states as x
1
position, x
2
velocity, we get
x
1
x
2
x
2
a(1 x
1
2
) x
2
x
1
u
For the van der Pol oscillator, the required M-Iile is
function xdot vdpol (t, x)
alpha 0.8; u 0;
xdot x(2); alpha`(1 - x(1)^2)`x(2) - x(1) + u];
where it is assumed that u(t) 0. Now the sequence oI commands required to
invoke ode23 and obtain time history plots, Ior instance, over a time horizon oI
50 sec is
t0 0; tf 50;
x0 0.1;0.1];
t,x] ode23(vdpol`, t0 tf], x0);
plot(t, x)
The phase-plane plot oI x2 versus x1 is obtained using the command:
plot(x(:,1), x(:,2))
10. Bui/4 e prttypc
As a Iinal step beIore production, it is common to build and test a prototype. At
this point, we veriIy the quality oI the model, discover unsuspected vibration
and other modes, and consider ways to improve the design. AIter these tests,
we may reconsider the sensor, actuator and process unless time, money or
ideas have run out.
MATLABfSIMLLIK
In the simulation process, the computer is provided with appropriate input data
and other inIormation about system structure, operates on this input data and
generates output data, which it subsequently displays. Several soItware
packages that have been produced over the last two decades include computer
programs that allow these simulation operations. Over the years, these
simulation packages have become quite sophisticated, powerIul and very
'user-Iriendly. The useIulness and importance oI these soItware packages is
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 88
undeniable, because they greatly Iacilitate the analysis and design oI control
systems. They provide a tremendous tool in the hands oI control engineers.
However, a word oI caution must be sounded. The availability oI such
packages and the ease with which one can use them should in no way detract
one Irom learning the underlying concepts. Mastry oI the theoretical Iounda-
tion is a prerequisite Ior its correct implementation.
MATLAB/SIMULINK is one oI the most successIul soItware packages
currently available, and is particularly suited Ior work in control. It is a power-
Iul, comprehensive and user-Iriendly soItware package Ior simulation studies.
Our objective here is to help the reader gain a basic understanding oI this
soItware package by showing how to set up and solve a simulation problem.
Interested readers are encouraged to Iurther explore this very complete and
versatile mathematical computation package.
A very nice Ieature oI SIMULINK is that it visually represents the simulation
process by using simulation block diagrams. Especially, Iunctions are repre-
sented by 'subsystem blocks that are then interconnected to Iorm a
SIMULINK block diagram that deIines the system structure. Once the struc-
ture is deIined, parameters are entered in the individual subsystem blocks that
correspond to the given system data. Some additional simulation parameters
must also be set to govern how the numerical computation will be carried out
and how the output data will be displayed. As a matter oI Iact, the SIMULINK
block diagrams are essentially the same we have used in the text to describe
control system structures and signal Ilow.
Because Simulink is graphical and interactive, we encourage you to jump
right in and try it. For a technical introduction to Simulink, read the document
'Using Simulink. To help you start using Simulink quickly, we describe here
the simulation process though a demonstration example on MicrosoIt
Windows platIorm with MATLAB version 6, Control Toolbox version 5 and
SIMULINK version 4.
To start SIMULINK, enter simulink command at the MATLAB prompt.
SIMULINK Library Browser appears which displays tree-structured view oI
the SIMULINK block libraries. It contains several nodes; each oI these nodes
represents a library oI subsystem blocks that is used to construct simulation
block diagrams. You can expand/collapse the tree by clicking on the + -
boxes beside each node.
Expand the node labeled 'Simulink. Subnodes oI this node (Continuous,
Discrete, Functions & Tables, Math, Nonlinear, Signals & Systems, Sinks,
Sources) are displayed. Expanding the 'Sources subnode displays a long list
oI Sources library blocks; contents are displayed in the diagram view. The
purpose oI the block 'Step is to generate a step Iunction. The block 'Con-
stant generates a speciIied real or complex value, independent oI time.
You may now collapse the Sources subnode, and expand the 'Sinks
subnode. A list oI Sinks library blocks appears. The purpose oI block labeled
'XY Graph is to display an X-Y plot oI signals using a MATLAB Iigure
window. The block has two scalar inputs; it plots data in the Iirst input (the x
igiral Conrrol and Srarc \ariallc Mcrhods 80
direction) against data in the second input (the v direction). This block is useIul
Ior phase-plane analysis. The block 'Scope displays its inputs (signals gener-
ated during a simulation) with respect to simulation time. The block 'To
Workspace transIers the data to MATLAB workspace.
You may now collapse the Sinks subnode and expand the 'Continuous
subnode. A list oI library blocks corresponding to this subnode appears. The
purpose oI the 'Derivative block is to output the time derivative oI the input.
We will use this block Ior phase-plane analysis. The 'State-Space block im-
plements a linear system whose behaviour is described by a state variable
model. The 'TransIer Fcn block implements a transIer Iunction.
The 'Nonlinear subnode has blockset oI various nonlinearities: Backlash,
Coulomb and Viscous Friction, Deadzone, Relay, Saturation, etc.
The 'Math subnode has several blocks. The block 'Sum generates the
sum oI inputs. It is useIul as an error detector Ior control system simulations.
The 'Sign block indicates the sign oI the input (The output is 1 when the input
is greater than zero: the output is 0 when the input is equal to zero; and the
output is 1 when the input is less then zero). We can use this block to repre-
sent ideal relay nonlinearity.
Expand now the node 'Control System Toolbox. The block 'LTI system
accepts the continuous and discrete objects as deIined in the Control System
Toolbox. TransIer Iunctions and state-space Iormats are supported in this
block.
We have described some oI the subsystem libraries available that contain the
basic building blocks oI simulation diagrams. The reader is encouraged to
explore the other libraries as well. You can also customize and create your own
blocks. For inIormation on creating your own blocks, see the MATLAB docu-
mentation on 'Writing S-Functions.
We are now ready to proceed to the next step, which is the construction oI
a simulation diagram. To do this, we need to open a new window. Click the
New button on the Library Browser`s toolbar. A new window opens up that
will be used to build up an interconnection oI SIMULINK blocks Irom the
subsystem libraries. This is an 'untitled window; we call it the Simulation
Window. We consider here phase-plane analysis oI nonlinear system described
in Review Example 10.5.
With the 'Nonlinear subnode oI Simulink node expanded, move the pointer
and click the block labeled 'Saturation, and while keeping the mouse button
pressed down, drag the block and place it inside the Simulation Window, and
release the mouse button.
With the 'Control System Toolbox node expanded, click the block labeled
'LTI system, drag to the Simulation Window and place it on one side oI the
Saturation block. Duplicate 'LTI system on the other side oI Saturation block.
Drag the block labeled 'Sum Irom the 'Math subnode oI Simulink node,
the block 'Constant Irom the 'Sources subnode oI Simulink node, the blocks
'XY Graph and 'To Workspace Irom 'Sinks subnode oI Simulink node,
and the block 'Derivative Irom the 'Continuous subnode oI Simulink node.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 81
We have now completed the process oI dragging subsystem blocks Irom
the appropriate libraries and placing them in the Simulation Window. The next
step is to interconnect these subsystem blocks and obtain the structure oI
simulation block diagram. To do this, we just need to work in the Simulation
Window.
The Iirst step is to rearrange the blocks in the Simulation Window in a speci-
Iied structure. This will require moving a block Irom one place to another
within the Simulation Window. This can be done by clicking inside the block,
keeping the mouse button pressed, dragging the block to the new desired loca-
tion and releasing mouse button.
Lines are drawn to interconnect these blocks as per the desired structure. A
line can connect the output port oI one block with the input port oI another
block. A line can also connect the output port oI one block with input ports oI
many blocks by using branch lines.
To connect the output port oI one block to the input port oI another block,
position the pointer on the Iirst block`s output port; the pointer shape changes
to a crosshair. Press and hold down the mouse button. Drag the pointer to the
second block`s input port. You can position the pointer on or near the port; the
pointer shape changes to a double crosshair. Release the mouse button.
SIMULINK replaces the port symbols by a connecting line with an arrow
showing the direction oI signal Ilow.
A branch line is a line that starts Irom an existing line and carries its signal to
the input port oI a block. Both the existing line and the branch line carry the
same signal. To add a branch line, position the pointer on the line where you
want the branch line to start. While holding down the Ctrl key, press and hold
down the mouse button. Drag the pointer to the input port oI the target block,
then release the mouse button and the Ctrl key.
SIMULINK draws connecting lines using horizontal and vertical line
segments (To draw a diagonal line, hold down the Shift key while drawing the
line). The branch lines are usually an interconnection oI line segments. With the
Ctrl key pressed, identiIy the branch point and drag the mouse (horizontally/
vertically) to an unoccupied area oI the diagram and release the mouse button.
An arrow appears on the unconnected end oI the line. To add another line
segment, position the pointer over the end oI the segment and draw another
segment.
To move a line segment, position the pointer on the segment you want to
move. Press and hold down the leIt mouse button. Drag the pointer to the
desired location and release.
To disconnect a block Irom its connecting lines, hold down the Shift key,
then drag the block to a new location. You can insert a block in a line by
dropping the block on the line.
You can duplicate blocks in a model as Iollows.
While holding down the Ctrl key, select the block with the mouse button,
then drag it to the new location. The duplicated block has the same parameter
values as the original block.
igiral Conrrol and Srarc \ariallc Mcrhods 82
You can cancel the eIIects oI an operation by choosing Undo Irom the Edit
menu oI the Simulation Window. You can thus undo the operations oI adding/
deleting a line/block. EIIects oI Undo command may be reversed by choosing
Redo Irom the Edit menu.
To delete a block/line, select a block/line to be deleted and choose Clear or
Cut Irom the Edit menu. The Cut command writes the block/line into the
clipboard, which enables you to Paste it into a model. Clear command does
not enable you to paste the block/line later.
This gives us a generic diagram because we have not yet speciIied the LTI
system nor set parameter values oI saturation, reIerence input, and error
detector. Our next priority is to go into each oI these blocks and set the param-
eters that correspond to our speciIic nonlinear system. In addition, we need to
set some simulation parameters.
We begin with the reIerence input to the Ieedback system by double-click-
ing on the block labeled 'Constant in the Simulation Window. A dialog box
pops up. Only one parameter need to be set: constant value. Set the value to 0
since our reIerence input is zero. When we are done, we click OK.
Next we set the 'Sum block. In the dialog box Ior this block, we enter Icon
shape: round, and list oI signs, . This gives us an error detector Ior negative
Ieedback system.
Next we set the LTI system blocks. There are two blocks on the two sides
oI the saturation nonlinearity. The Iirst block has the transIer Iunction
1/(s 1), and the second block has the transIer Iunction 1/s. Since our
simulation study is with respect to initial condition on output, we convert the
transIer Iunctions to state-space Iorm. Enter the initial condition 1.6 in the
dialog box oI the second block.
Saturation block dialog box requires upper limit and lower limit oI saturation.
0.4 and 0.4 are the values as per our problem.
Next we need to set the parameters Ior the 'XY Graph block. Dialog box
requires x-min, x-max, v-min and v-max. The values |1 2 2 1| may be
entered.
'To Workspace block requires variable name and the Iormat. We use
matrix Iormat Ior our data and enter variable names x1 and x2 in the dialog
boxes.
Finally, we need to set the parameters Ior the simulation run. We move the
pointer to the menu labeled 'Simulation, and enter parameters: start time, stop
time, in the dialog box oI submenu 'Parameters. Also we tick against 'Normal
Simulation submenu oI 'Simulation menu.
All block names in a model must be unique and must contain at least one
character. By deIault, block names appear below blocks. To edit a block name,
click on the block name and insert/delete/write text. AIter you are done, click
the pointer somewhere else in the model, the name is accepted or rejected. II
you try to change the name oI a block to a name that already exists, SIMULINK
displays an error message.
At this point in the simulation process, we have generated the appropriate
SIMULINK block diagram (shown in Fig. B.1) and entered the speciIic
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 83
parameters Ior our system and simulation. We are now ready to execute the
program, and have the computer perIorm the simulation. We move the pointer
to the 'Simulation menu and choose 'Start. A new window that shows the
phase trajectory pops up.
You may now execute the Iollowing program in MATLAB workspace.
figure (1);
plot (x1,x2); grid;
hold on
Resimulate Ior an initial condition oI 0.74 and plot the phase trajectory.
We have used an example to show how to enter data and carry out a simu-
lation in the SIMULINK environment. The reader will agree that this is a very
simple process.
Reference
0
ss(tf(1, [1 1])) (ss(tf(1, [1 0]))
LTI System1 Saturation
du/dt
LTI System2
X to Workspace
Phase Plane
Y to Workspace
Derivative
x_2
x_1
Fig. B.1
PROBLEMS
Each problem covers an important area oI control system analysis or design.
Important MATLAB commands are included as help to MATLAB problems, in
the Iorm oI script Iiles. Simulation Diagrams are included as help Ior the
problems requiring SIMULINK.
Following each problem, one or more what-iI`s may be posed to examine
the eIIect oI variations oI the key parameters. Comments to alert the reader to
the special Ieatures oI MATLAB commands are included in the script Iiles to
enhance the learning experience. Partial answers to the problems are given in
the text.
The description oI the MATLAB Iunctions used in the script Iiles can easily
be accessed Irom the help file using help command.
B.1 Lxcm(| 3.1 rr///4
Consider a unity-Ieedback system with open-loop transIer Iunction
G(s)
1
1 s s ( ) +
(a) Plot the step response oI the Ieedback system and determine error
igiral Conrrol and Srarc \ariallc Mcrhods 84
constants K
p
, K
L
and K
a
.
(b) Discretize the system (sampling interval T 1 sec) and plot the step
response oI the resulting Ieedback system. Also determine the error con-
stants.
(c) Approximate the sampled system by an equivalent analog system with
input delay oI T/2. Plot the step response oI the resulting analog Ieed-
back system.
(d) Using LTI Viewer, determine peak overshoot and settling time oI analog
and sampled systems.
B.2 Lxcm(| 3.2 rr///4
Consider a unity-Ieedback system with open-loop transIer Iunction
G(s)
K
s s ( ) + 2
(a) Sketch root locus plot and determine the range oI gain K Ior which the
system is stable.
(b) Discretize the system (sampling interval T 0.4 sec) and sketch root
locus plot. Find the range oI gain K Ior which the system is stable.
(c) Repeat (b) Ior T 3 sec.
B.3 Lxcm(| 3.3 rr///4
Consider a system with transIer Iunction
G(s)
e
s s
s -
+
1 5
1
.
( )
Discretize this system (sampling time T 1 sec) and report the result in
zero-pole-gain Iorm.
B.+ Lxcm(| 2.10 rr///4
A unity-Ieedback sampled-data system (sampling interval T 0.04 sec) has
plant transIer Iunction
G(s)
10
1 0 5 1 01 1 0 05 ( . )( . )( . ) + + + s s s
An approximating analog system is a unity-Ieedback system with plant transIer
Iunction G(s)e
Ts/2
. Show that the analog controller
D(s)
0 67 1
2 1
.
( )
s
s
+
+
meets the speciIication: phase margin 40. Determine the bandwidth oI the
compensated system.
Discretize the design, and analyze the step response oI the digital system
using LTI Viewer (Ans: Peak overshoot 13; Settling time 1.16 sec)
B.5 Lxcm(| 1.3 rr///4
A unity-Ieedback system has open-loop transIer Iunction
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 85
G(s)
K
s s ( ) + 5
It is desired to have the velocity error constant K
L
10. Furthermore, we
desire that the phase margin oI the system be about 40 and bandwidth about
5.5 rad/sec. Design a digital control scheme (T 0.1 sec) to meet these
speciIications.
Using LTI Viewer, determine peak overshoot and settling time Irom the step
response oI the Ieedback system (Ans: Peak overshoot 34; Settling time
3 sec)
Are your results diIIerent Irom the ones given in the text? Why?
B.6 Lxcm(| 1.1 rr///4
Repeat problem B.5 under the constraint that we use phase-lead compensation
to achieve the Iollowing perIormance speciIications:
(i) K
L
10
(ii) Phase margin 40
(iii) Bandwidth 12 rad/sec
(Ans: Peak overshoot 35; Settling time 1 sec)
B.7 Lxcm(| 1. rr///4
A unity-Ieedback system has open-loop transIer Iunction
G(s)
K
s s ( ) + 2
It is desired that dominant closed-loop poles provide damping ratio z 0.5 and
have undamped natural Irequency w
n
4 rad/sec. Velocity error constant K
L
is
required to be about 2.5.
Design a digital control scheme (T 0.2 sec) Ior the system to meet these
speciIications.
PerIorm simulation study on the compensated system using LTI Viewer
(Ans: Peak overshoot 15; Settling time 2.2 sec)
B.8 In the Iollowing, we point the reader to important matrix Iunctions in
MATLAB. Access the description oI these Iunctions Irom the help file, and
execute each Iunction, taking suitable data Irom the text.
Identity matrix : eye(n)
Dimensions : size(A)
Utility matrices : ones(n), ones(m,n), ones(size(A)),
zeros(n), zeros(m,n), zeros(size(A))
Complex conjugate transpose : ctranspose(A); A
Non-conjugate transpose : transpose(A); A .
Determinant : det(A)
Inverse : inv(A)
Rank : rank(A)
Trace : trace(A)
igiral Conrrol and Srarc \ariallc Mcrhods 8
Spectral norm : norm(A)
(Largest singular value)
Euclidean norm oI a vector : norm(x)
Condition number with : cond(A)
respect to inversion
Eigenvalues : eig(A)
Eigenvectors : P,A1] eig(A)
Characteristic equation : poly(A)
Matrix exponential : expm(A)
B. Given the transIer Iunction
G(s)
s
s s s
3 2
2 2 5 0 5 + + + . .
(a) Obtain a state-space model sys, equivalent to the given G(s).
(b) Discretize the model sys (sampling interval T 0.1 sec) to obtain sysd.
(c) Simulate and plot the response oI the models sys and sysd, when the
input is
u(t)
2 0 2
0 5 2
;
. ;

R
S
T
t
t
and the initial condition is x(0) |1 0 2|
T
.
B.10 Lxcm(| .2 rr///4
Linearized equations governing the inverted pendulum system oI Fig. 5.16 are
x Ax bu
x q q

: :
T
A
0 1 0 0
4 4537 0 0 0
0 0 0 1
0 5809 0 0 0
.
. -
L
N
M
M
M
M
M
O
Q
P
P
P
P
P
; b
0
0 3947
0
0 9211
-
L
N
M
M
M
M
M
O
Q
P
P
P
P
P
.
.
(a) Show that the open-loop system is unstable.
(b) Design state Ieedback u kx that results in closed-loop poles at
1, 1, 1, 1.
(c) Simulate the Ieedback system. Given initial state
x(0) |0.1 0 0 0|
T
B.11 Lxcm(| . rr///4
The plant model oI a satellite attitude control system (ReIer Figs 7.37.4) is
x Ax bu
v cx
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 87
with A
0 1
0 0
L
N
M
O
Q
P
; b
0
1
L
N
M
O
Q
P
; c |1 0|
(a) Design state Ieedback u kx that results in closed-loop poles at
4 + f4.
(b) Assuming that the state vector x(t) is measurable, simulate the Ieedback
system Ior x(0) |1 0|
T
.
(c) Consider now that state measurements are not practical. Design a state
observer that yields estimated states
~
x (J). Place the observer poles at
10, 10.
(d) Obtain state variable model oI the compensator by cascading the state
Ieedback control law and the state observer. Find the transIer Iunction
oI the compensator.
(e) Set up state model oI the Iorm (7.57) Ior the observer-based regulator
system and simulate the model (Note that x(0) |1 0|
T
leads to
~
x (0) |1 0|
T
when

x(0) 0).
B.12 Lxcm(| .13 rr///4
The plant model oI a satellite attitude control system (ReIer Figs 7.37.4) is
x(k 1) Fx(k) gu(k)
v(k) cx(k)
with
F
1
0 1
T
L
N
M
O
Q
P
; g
T
T
2
2 / L
N
M
O
Q
P
; T 0.1 sec
c |1 0|
The reIerence input q
r
is a step Iunction.
Design state Ieedback u k
1
(x
1
(k) q
r
) k
2
x
2
(k) that results is deadbeat
response.
Simulate the Ieedback system Ior a unit-step input q
r
.
B.13 Reconsider the inverted pendulum regulator problem raised in Problem
B.10, wherein you designed state Ieedback control based on pole-placement.
Now design a state-Ieedback control law that minimizes the perIormance
index
J
1
2
0

z
(x
T
Qx u
T
Ru)dt
with
Q
100 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
L
N
M
M
M
M
M
O
Q
P
P
P
P
P
; R 0.01
igiral Conrrol and Srarc \ariallc Mcrhods 88
Simulate the Ieedback system Ior initial state x(0) |0.1 0 0 0|
T
.
B.1+ Reconsider the inverted pendulum system oI problem B.10.
(a) Discretize the plant model (sampling interval T 0.1 sec).
(b) Introduce integral state in the plant equations (ReIer Eqn. (7.109)) and
show that the augmented system is controllable.
(c) Design state Ieedback with integral control that minimizes the perIor-
mance index
J
1
2
0 k =

|x
T
(k)Qx(k) u
T
(k)Ru(k)|
with
Q
10 0 0 0 0
0 1 0 0 0
0 0 100 0 0
0 0 0 1 0
0 0 0 0 1
L
N
M
M
M
M
M
M
M
O
Q
P
P
P
P
P
P
P
; R 1
(d) Simulate the digital servo (ReIer Fig. 7.17) Ior a step input.
B.15 Br/o Lxcm(| 10.3 rr///4
Figure 10.40a shows the block diagram oI a nonlinear system with saturation
nonlinearity.
(a) Sketch the Nyquist plot Ior the linear transIer Iunction
G(s)
1
1 2 1 s s s ( )( ) + +
(b) Superimpose on this plot, the plot oI describing Iunction oI saturation
nonlinearity.
(c) Show the existence oI a stable limit cycle and determine its amplitude
and Irequency.
(d) Drag the Iollowing blocks Irom SIMULINK block libraries:
(i) 'Sum Irom Math subnode oI Simulink node;
(ii) 'Saturation Irom Nonlinear subnode oI Simulink node;
(iii) 'LTI system Irom Control System Toolbox node: and
(iv) 'Scope Irom Sinks subnode oI Simulink node.
Setup a simulation block diagram as per the Ieedback structure given in
Fig. 10.40a. Simulate the system Ior an initial condition oI x0 |5 0 0|
T
.
The SIMULINK response shows a limit cycle. Determine the amplitude and
Irequency oI the limit cycle and compare these parameters with the ones
obtained in part (c).
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 8
Script PB.1
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 3.1')
Lffects of sampT1nq on response
AnaToq system
0tf{1,|1 1 0|),
Mfeedback{0,1),
1rans1ent response
f1qure{1)
step{M),
Steady-state response
Kpdcqa1n{0)
0vtf{|1 0|,1)*0,
Kvdcqa1n{0v)
0atf{|1 0|,1)*0v,
Kadcqa1n{0a)
hoTd on
SampTed system
1s1nput{'Lnter sampT1nq t1me .')
0zc2d{0,1s),
Mzfeedback{0z,1),
1rans1ent response
Step{Mz),
Steady-state response
Kpzdcqa1n{0z)
0vztf{|1 -1|,1,1s)*0z]1s,
Kvzdcqa1n{0vz)
0aztf{|1 -1|,1,1s)*0vz]1s,
Kazdcqa1n{0az)
hoTd off
DeTay approx1mat1on of ZON.
kefer LxampTe 2.10.
f1qure{2)
step{M),
hoTd on
0dtf{1,|1 1 0|,'1nputDeTay',1s]2),
0d1pade{0d,2),
M1feedback{0d1,1),
step{M1),
hoTd off
Us1nq L11 V1ewer,determ1ne peak overshoot
igiral Conrrol and Srarc \ariallc Mcrhods 00
& settT1nq t1me of anaToq & sampTed systems.
Tt1v1ew{'step',M,M1)
Script PB.2
cTear aTT,cTose aTT
d1sp{'kefer LxampTe 3.2')
Lffect of sampT1nq on stab1T1ty
0tf{1,|1 2 0|),
f1qure{1)
rTocus{0),sqr1d
ax1s equaT
pause
Wa1ts for user to str1ke any key.
1s1nput{'Lnter sampT1nq t1me.')
0zc2d{0,1s),
f1qure{2)
rTocus{0z),zqr1d,
ax1s equaT
|K1,p1|rTocf1nd{0z)
Script PB.3
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 3.3')
D1scret1zat1on of system w1th dead-t1me
11,N1,deTta0.5,
0tf{1,|1 1|,'1nputDeTay',deTta*1),
0z1c2d{0,1),
0z2tf{1,|1 0|,1),
0z0z1*0z2,
zpk{0z)
Script PB.1
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 2.10')
D1q1taT 1mpTementat1on of AnaToq Des1qn
Approx1mat1on of sampTed-data system
1s0.04,
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 01
denconv{conv{|0.5 1|,|0.1 1|),|0.05 1|),
0tf{10,den,'1nputDeTay',1s]2),
01pade{0,2),
AnaToq Des1qn
f1qure{1)
Dtf{|0.61 1|,|2 1|),
marq1n{D*01)
f1qure{2)
L11 V1ewer funct1ons are ava1TabTe
1n f1qure w1ndow.Zoom 1n req1on of -3db
contour & read bandw1dth.
0cD*01,
nqr1d,
n1choTs{0c),
D1scret1zat1on of Des1qn
Dzc2d{D,1s,'tust1n')
00tf{10,den),
0zc2d{00,1s),
Mzfeedback{Dz*0z,1),
Tt1v1ew{'step',Mz)
Script PB.5
cTear aTT,
cTose aTT,
d1sp{'kefer LxampTe 4.3')
D1rect D1q1taT Des1qn{Taq compensat1on)
Uncompensated system
0tf{50,|1 5 0|),
D1scret1zat1on
0zc2d{0,0.1),0z1zpk{0z),
Des1qn 1n w-doma1n
0wd2c{0z,'tust1n'),
f1qure{1),
marq1n{0w),
kead uncompensated phase marq1n from f1qure 1.
wToqspace{-1,1,100),
|maq,ph|bode{0w,w),
maq & ph are arrays,MA1LAb funct1on 1nterp1
does not accept these arrays.keshape the
arrays 1nto coTumn vectors.
maqreshape{maq,100,1),
phreshape{ph,100,1),
igiral Conrrol and Srarc \ariallc Mcrhods 02
h1-180+spec1f1ed phase marq1n+eps1Ton-130
h11nput{'Lnter phase anqTe h1.')
SeTect frequency ranqe properTy,funct1on 1nterp1
requ1res monoton1c data.
wc21nterp1{ph,w,h1)
wc2 1s the des1red qa1n crossover .
beta1nterp1{ph,maq,h1),
Upper corner frequency at wc2]4.
wcu1nput{'Lnter upper corner frequency.')
tau1]wcu,
Dwtf{|tau 1|,|beta*tau 1|)
D1q1taT controTTer
Dc2d{Dw,0.1,'tust1n'),
Dzzpk{D)
f1qure{2)
kead phase marq1n of compensated system
from f1qure 2.
marq1n{Dw*0w),
bandw1dth{uncompensated &compensated)
w|5.0.1.15|,
|maq,ph,w|bode{feedback{0w,1)),
maqdb20*Toq10{maq),
wb1nterp1q{-maqdb,w,3)
|maq1,ph1,w|bode{feedback{Dw*0w,1)),
maq1db20*Toq10{maq1),
wb11nterp1q{-maq1db,w,3)
AnaTys1s on N1choTs chart
f1qure{3),
0wcDw*0w,
nqr1d,
n1choTs{0w,0wc),
Step-response anaTys1s us1nq L11 V1ewer
Mzfeedback{D*0z,1),
Tt1v1ew{'step',Mz)
Carry out des1qn on 0U1
Script PB.6
cTear aTT,
cTose aTT,
d1sp{'kefer LxampTe 4.4')
D1rect D1q1taT Des1qn{Tead Compensat1on)
Uncompensated system
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 03
0tf{50,|1 5 0|),
D1scret1zat1on
0zc2d{0,0.1),
Des1qn 1n w-doma1n
0wd2c{0z,'tust1n'),
f1qure{1)
marq1n{0w),
kead uncompensated phase marq1n from f1qure 1.
h1Mspec1f1ed phase marq1n-uncompensated
phase marq1n+eps1Ton35
h1M1nput{'Lnter requ1red phase Tead .')
aTpha{1-s1n{h1M*p1]180))]{1+s1n{h1M*p1]180)),
wToqspace{0,2,100),
|maq,ph|bode{0w,w),
maqdb20*Toq10{maq),
maqdbreshape{maqdb,100,1),
wm1nterp1{maqdb,w,-20*Toq10{1]sqrt{aTpha))),
tau1]{wm*sqrt{aTpha)),
Dwtf{|tau,1|,|aTpha*tau,1|)
D1q1taT controTTer
Dc2d{Dw,0.1,'tust1n'),
Dzzpk{D)
f1qure{2),
kead compensated phase marq1n from f1qure 2.
marq1n{Dw*0w),
bandw1dth{uncompensated & compensated)
w|5.0.1.25|,
|maq,ph,w|bode{feedback{0w,1)),
maqdb20*Toq10{maq),
wb1nterp1q{-maqdb,w,3)
|maq1,ph1,w|bode{feedback{Dw*0w,1)),
maq1db20*Toq10{maq1),
wb11nterp1q{-maq1db,w,3)
AnaTys1s on N1choTs chart
f1qure{3)
0wcDw*0w,
nqr1d,
n1choTs{0w,0wc)
Step-response anaTys1s us1nq L11 V1ewer
Mzfeedback{D*0z,1),
Tt1v1ew{'step',Mz)
Carry out the des1qn on 0U1
igiral Conrrol and Srarc \ariallc Mcrhods 04
Script PB.7
cTose aTT
cTear aTT
d1sp{'kefer LxampTe 4.1')
D1q1taT ControTTer Des1qn on kootTocus pTots
Tant modeT
0tf{1,|1 2 0|),
10.2,
0zc2d{0,1),0z1zpk{0z),
zeta0.5,wn4,
thetawn*1*sqrt{1-zeta2),
f1qure{1)
Uncompensated root Toc1
rTocus{0z),
1ake near-zero vaTue for wn 1n zpchart funt1on
1f you are not us1nq wn Tocus 1n your des1qn procedure.
zpchart{qca,0.5,.01),
kepTace zpchart command by zqr1d{zeta,wn) 1f work1nq w1th
MA1LAb 5.3 vers1on.
ax1s equaT,
hoTd on
Locate des1red dom1nant roots.
poTar{theta*|1 1|,|0 1|,'k'),
0a1n ad]ustment does not sat1sfy specs.
Lead compensator zero to canceT open-Toop
poTe at z0.61.1ake poTe at zaTpha.
aTpha1nput{'Lnter tr1aT vaTue of aTpha.')
Dztf{|1 -0.61|,|1 -aTpha|,1),
f1qure{2)
rTocus{Dz*0z),
zpchart{qca,zeta,0.01),
ax1s equaT,
hoTd on
poTar{theta*|1 1|,|0 1|,'k'),
|KK,poTesCL|rTocf1nd{Dz*0z)
Tace the crossha1r cursor at des1red root & cT1ck.
0vztf{|1 -1|,1,1)*Dz*KK*0z]1,
Kvzdcqa1n{0vz)
erform s1muTat1on study on compensated system
us1nq L11 V1ewer.
Mzfeedback{KK*Dz*0z,1),
Tt1v1ew{'step',Mz)
Carry out the des1qn on 0U1.
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 05
Script PB.9
cTear aTT
cTose aTT
d1sp{'State Space AnaTys1s')
01ven transfer funct1on
num|1 0|,
den|1 2 2.5 0.5|,
0tf{num,den)
Construct state var1abTe modeT
sysss{0),
|A,b,c,d|ssdata{sys)
D1scret1zat1on
10.1,
sysdc2d{sys,1),
|l,q,c,d|ssdata{sysd)
S1muTat1on
t|0.0.1.20|',
x0|1,0,2|',
1nput for 0<t<2.
u{1.20)2*ones{20,1),
1nput for t2.
u{21.201)0.5*ones{181,1),
|y,t,X|Ts1m{sys,u,t,x0),
|y1,t,X1|Ts1m{sysd,u,t,x0),
f1qure{1)
pTot{t,X{.,1),t,X1{.,1),'o'),qr1d,
Teqend{'x_1'),
f1qure{2)
pTot{t,X{.,2),t,X1{.,2),'o'),qr1d,
Teqend{'x_2'),
f1qure{3)
pTot{t,X{.,3),t,X1{.,3),'o'),qr1d,
Teqend{'x_3'),
Script PB.10
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 1.2')
kequTator Des1qn{oTe-pTacement) for 1nverted enduTum
Tant ModeT
A|0,1,0,0,4.4531,0,0,0,0,0,0,1,-0.5809,0,0,0|,
b|0,-0.3941,0,0.9211|,
igiral Conrrol and Srarc \ariallc Mcrhods 0
c|0 0 1 0|,d0,
sysss{A,b,c,d),
Uctrb{A,b),
ControTTabTeoTesrank{U)
kequTator Des1qn
poTesOLpoTe{sys)
poTesCL|-1,-1,-1,-1|,
kacker{A,b,poTesCL)
kequTatoroTese1q{A-b*k)
S1muTat1on
x0|0.1,0,0,0|',
t|0.0.1.20|,
sysCLss{A-b*k,|0,0,0,0|,c,0),
|y,t,X|Ts1m{sysCL,0*t,t,x0),
f1qure{1)
subpTot{2,2,1),pTot{t,X{.,1)),qr1d,Teqend{'x_1'),
subpTot{2,2,2),pTot{t,X{.,2)),qr1d,Teqend{'x_2'),
subpTot{2,2,3),pTot{t,X{.,3)),qr1d,Teqend{'x_3'),
subpTot{2,2,4),pTot{t,X{.,4)),qr1d,Teqend{'x_4')
Script PB.11
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 1.1')
Observer-based kequTator for SateTT1te Att1tude ControT
Tant ModeT
A|0 1,0 0|,b|0,1|,c|1 0|,
kequTator Des1qn
poTesCL|-4+41,-4-41|,
kpTace{A,b,poTesCL)
kequTatorpoTese1q{A-b*k)
sysss{A-b*k,|0,0|,c,0),
S1muTat1on
t|0.0.01.1|,
x0|1 0|',
|y,t,X|1n1t1aT{sys,x0,t),
f1qure{1)
pTot{t,y),
hoTd on
Observer Des1qn
poTesOb|-10 -10|,
kkacker{A',c',poTesOb),
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 07
mkk'
ObserverpoTese1q{A-m*c)
kefer Lqns.{1.58)&{1.59)
sys_compss{A-b*k-m*c,m,k,0),
Dtf{sys_comp)
S1muTat1on
kefer Lqn.{1.51)
A1A-b*k,A2b*k,A3zeros{s1ze{A)),A4A-m*c,
A_cT|A1{1,.),A2{1,.),A1{2,.),A2{2,.),A3{1,.),A4{1,.),A3{2,.),A4{2,.)|,
sysCLss{A_cT,|0,0,0,0|,|1 0 0 0|,0),
x0|1 0 1 0|',
|y1 t X1|1n1t1aT{sysCL,x0,t),
pTot{t,y1,'r'),qr1d,
Teqend{'Output w1th no observer','Output w1th observer')
hoTd off
f1qure{2)
pTot{t,X1{.,3),t,X1{.,4)),qr1d,
Teqend{'xt1Tde_1','xt1Tde_2')
Script PB.12
cTear aTT,
cTose aTT,
d1sp{'kefer LxampTe 1.13')
Deadbeat controTTer for SateTT1te Att1tude ControT
Tant ModeT
10.1,
l|1,1,0,1|,q|12]2,1|,c|1,0|,
sysdss{l,q,c,0,1),
oTe pTacement
poTesCL|0,0|,
kacker{l,q,poTesCL)
Step response
sysdCLss{l-q*k,100*q,c,0,'1s',1),
step{sysdCL)
Script PB.13
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 1.2')
L1near Quadrat1c kequTator for 1nverted enduTum
Tant ModeT
igiral Conrrol and Srarc \ariallc Mcrhods 08
A|0,1,0,0,4.4531,0,0,0,0,0,0,1,-0.5809,0,0,0|,
b|0,-0.3941,0,0.9211|,
c|1,0,0,0|,
sysss{A,b,c,0),
Uctrb{A,b),
ControTTabTeoTesrank{U)
erformance 1ndex
Q|100,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1|,k0.01,
State leedback
|k L|Tqr{A,b,Q,k),
oTesCLL
0a1nMatr1xk
sysCLss{A-b*k,|0,0,0,0|,c,0),
S1muTat1on
x0|0.1,0,0,0|',
t|0.0.1.20|,
|y,t,X|1n1t1aT{sysCL,x0,t),
subpTot{2,2,1),pTot{t,X{.,1)),qr1d,Teqend{'x_1'),
subpTot{2,2,2),pTot{t,X{.,2)),qr1d,Teqend{'x_2'),
subpTot{2,2,3),pTot{t,X{.,3)),qr1d,Teqend{'x_3'),
subpTot{2,2,4),pTot{t,X{.,4)),qr1d,Teqend{'x_4'),
Script PB.11
cTear aTT
cTose aTT
d1sp{'kefer LxampTe 1.2')
D1q1taT Servo for 1nverted enduTum
Tant ModeT
A|0,1,0,0,4.4531,0,0,0,,0,0,0,1,-0.5809,0,0,0|,
b|0,-0.3941,0,0.9211|,
c|0,0,1,0|,
sysss{A,b,c,0),
10.1,
sysdc2d{sys,1),
|l,q,c,d|ssdata{sysd),
Tant ModeT w1th 1nteqraT state
kefer Lqn.{1.109)
l1|l{1,.),0,l{2,.),0,l{3,.),0,l{4,.),0,c*l,1|,
q1|q{1),q{2),q{3),q{4),c*q|,
c1|c,0|,
Uctrb{l1,q1),
Appcndix B. MA1AB Aidcd Conrrol Sysrcm csign. Convcnrional 0
rankUrank{U)
erformance 1ndex
Q|10,0,0,0,0,0,1,0,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,1|,
k1,
State leedback w1th 1nteqraT ControT
KdTqr{l1,q1,Q,k),
Kp|K{1),K{2),K{3),K{4)|
K1K{5)
S1muTat1on{step response)
kefer Lqns.{1.110)&{1.108)
l1_cTl1-q1*K,
sysCLss{l1_cT,|0,0,0,0,-1|,c1,0,'1s',1),
t|0.0.1.20|,
|y,t,X|step{sysCL,t),
pTot{t,y),qr1d
Script PB.15
cTear aTT,
cTose aTT,
d1sp{'kefer kev1ew LxampTe 10.3')
Descr1b1nq lunct1on AnaTys1s
Nyqu1st pTot for 0{s)
0tf{3,conv{conv{|2 1|,|1 1|),|1 0|)),
w|1.0.1.100|,
|re 1m w|nyqu1st{0),
rereshape{re,Tenqth{w),1),
1mreshape{1m,Tenqth{w),1),
pTot{re,1m),
ax1s{|-5 2 -5 2|),
hoTd on
Descr1b1nq lunct1on pTot for saturat1on
kefer Lqns.{10.51)-{10.53)
S1,
L|1.0.5.10|',
N|1.0,0.181,0.609,0.495,0.416,0.359,0.315,0.281,0.253,...
0.230,0.211,0.195,0.181,0.169,0.159,0.149,0.141,0.134,0.121|',
N1-1.]N,
re1N1,
1m10*Tenqth{N1),
pTot{re1,1m1,'ro'),qr1d,
Move the po1nter to the 1ntersect1on po1nt & cT1ck.
|X,Y|q1nput{1)
igiral Conrrol and Srarc \ariallc Mcrhods 10
L01nterp1{N1,L,X)
|maq ph w|bode{0),
phreshape{ph,Tenqth{w),1),
w01nterp1{ph,w,-180)
Fig. PB.15

S-ar putea să vă placă și