📄 control_system_toolbox.htm
字号:
<BLOCKQUOTE> <P>Transfer function:</P><P>-s^5 + 15 s^4 - 105 s^3 + 420 s^2 - 945 s + 945 <BR>-------------------------------------------------- <BR>s^5 + 15 s^4 + 105 s^3 + 420 s^2 + 945 s + 945</P></BLOCKQUOTE><P>Now, let us (for fun) compare the step response of tfpade with the idealstep response of the time-delay (of 2 sec.). To generate a time-delayed step,we will use "stepfun". </P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP"> <P>tfinal=5; [ypade,time]=step(tfpade,tfinal);<BR>T0=2; yideal=stepfun(time,T0);<BR>plot(time,[ypade,yideal])</P></TD></TR></TABLE><P>The plot will not be shown in this text, but it illustrates theapproximation effectively.</P> <hr><H3> <A NAME="c36"></A>3.6 The LTI-viewer</H3><P>LTI-viewer makes it easy to perform simulations, frequency response plotsetc. for one or several of the LTI-models which exist in the working directory.The LTI-viewer is easy to use. Just execute</P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP"> <P>Ltiview</P></TD></TR></TABLE><P>and try it. </P> <hr><H2><A NAME="c4"></A> 4 Controller design tools</H2><H3><A NAME="c41"></A>4.1 Root locus </H3><P>Given a closed-loop system with negative feedback and loop transfer functionk*L0(s), where k is a constant. [k*L0(s) is then the product of the individualtransfer functions in the loop.] The function "rlocus" calculates thepoles of the closed-loop system as a function of k. These poles are the rootlocus of the closed-loop system. The poles are the roots of the characteristicequation 1+k*L0(s). Here is one example: First, let us create the transferfunction L0(s):</P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP"> <P>L0=tf(1,[1 2 1 0])</P></TD></TR></TABLE><P>MATLAB's response is</P><BLOCKQUOTE> <P>Transfer function:</P><P>1<BR>--------------<BR>s^3 + 2 s^2 + s</P></BLOCKQUOTE><P> </P><P>Now, to plot the poles of the closed-loop system which have the looptransfer function of k*L0(s), we execute:</P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP"> rlocus(L0),sgrid </TD></TR></TABLE><P>The resulting figure showing the root locus is not shown here in this text.Note that "sgrid" plots a grid of z and w <SUB>0</SUB>-curves.("zgrid" does the same in the discrete-time case.) MATLAB choosesautomatically the proper range of k for which the root locus is drawn. However,we can use our own values of k by executing "rlocus(L0,k0)". Ofcoourse, we must have created k0 (a vector) in advance. </P><P>Once the root locus is drawn (using "rlocus"), we can choose apole location in the root locus plot, and ask MATLAB to calculate thecorresponding value of k. This is done with "rlocfind". As anexample, let us find (the approximate) value of k which causes one of theclosed-loop poles to be placed on the imaginary axis (the system is then on thestability limit). (It can be shown that k0=2 produces closed-loop poles at -2,± i.). We execute: </P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP"> [k0,pole0]=rlocfind(L0)</TD></TR></TABLE><P>"rlocfind" puts a crosshair cursor on the root locus plot. Let us,with the cursor, select the pole at +i (on the imaginary axis). As a result,MATLAB returns the both the selected point and the corresponding value of k: </P><BLOCKQUOTE> <P>selected_point=</P><P>-0.0023 + 0.9912i</P><P>k0=</P><P>1.9606</P><P>pole0=</P><P>-1.9921 </P><P>-0.0040 + 0.9921i</P><P>-0.0040 - 0.9921i</P></BLOCKQUOTE><P>In fact, our selected point (-0.0023 + 0.9912i) is not exactly on the rootlocus, but MATLAB finds the value of k0 corresponding to the nearest point, andcalculates the corresponding poles (pole0).</P> <hr><H3><A NAME="c42"></A>4.2 Pole placement </H3><P>Suppose the system to be controlled has the (continuous-time-) state-spacemodel dx/dt=Ax+Bu. The system is to be controlled by state-feedback: u=-Gxwhere G is a matrix of gains. Then the closed-loop system has the state-spacemodel dx/dt=Ax+B(-Gx)=(A-BG)x. The function "place" calculates G sothat the eigenvalues of (A-BG) (the closed-loop system) are as specified. Hereis one simple example: Assume the system to be controlled is given by dx/dt=u(which is an integrator, from u to x). The closed-loop eigenvalue shall beE=-4:</P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP"> E=-4;<BR>A=0;B=1;<BR>g1=place(A,B,E)</TD></TR></TABLE><P><BR>MATLAB's response is</P><BLOCKQUOTE> <P>place: ndigits=15</P><P>Warning: Pole locations are more than 10% in error.</P><P>g1=</P><P>4</P></BLOCKQUOTE><P>(The answer g1=4 is correct despite the warning message.) </P><P>"place" works similarly for <I>discrete-time</I> systems: Supposethe system to be controlled has the model </P><P ALIGN="CENTER">x(k+1)=A<SUB>d</SUB>x(k)+B<SUB>d</SUB>u(k) </P><P>and the controller is </P><P ALIGN="CENTER">u(k)=-G<SUB>d</SUB>x(k) </P><P>Then, the closed-loop system has the state-space model </P><P ALIGN="CENTER">x(k+1)=(A<SUB>d</SUB>-B<SUB>d</SUB>G<SUB>d</SUB>)x(k) </P><P>"place" calculates G<SUB>d</SUB> so that the eigenvalues of(A<SUB>d</SUB>-B<SUB>d</SUB>G<SUB>d</SUB>) (the closed-loop system) are asspecified in the vector E<SUB>d</SUB>. Thus, we can execute"Gd=place(Ad,Bd,Ed)". </P><P>"place" can be used to calculate <I>state-estimator</I> gains,too: Suppose given a system with state-space model </P><P ALIGN="CENTER">dx/dt=Ax+Bu, y=Cx+Du</P><P>and that the states x are to be estimated by the estimator </P><P ALIGN="CENTER">dx<SUB>e</SUB>/dt=Ax<SUB>e</SUB>+Bu+Ke,y<SUB>e</SUB>=Cx<SUB>e</SUB>+Du </P><P>where the residual e is given by e=y-y<SUB>e</SUB>. It can be shown that thestate estimation error z is given by dz/dt=(A-KC)z. The eigenvalues of thiserror model are given by E=eig(A-KC) <FONT FACE="Symbol" SIZE="2">º</FONT>eig(A'-C'K'). (Here, A' means the transpose of A.) Thus, we can calculate theestimator-gain by executing "K1=place(A',C',Ee); K=K1' ". </P> <hr><H3><A NAME="c43"></A>4.3 Optimal control</H3><P>The function "dlqr" performs linear-quadratic regulator design fordiscrete-time systems. This means that the controller gain G in the feedback </P><P ALIGN="CENTER">u(k)=-Gx(k)</P><P> for the controlled system </P><P ALIGN="CENTER">x(k+1)=A<SUB>d</SUB>x(k)+B<SUB>d</SUB>u(k)</P><P> is calculated so that the cost function </P><P ALIGN="CENTER">J=Sum {x'Qx + u'Ru + 2*x'Nu}</P><P>is minimized. The syntax is </P><P ALIGN="CENTER">[K,S,E]=dlqr(A<SUB>d</SUB>,B<SUB>d</SUB>,Q,R,N)</P><P>The matrix N is set to zero if omitted. Above, S is the solution of theRiccati equation, E contains the closed-loop eigenvalues which are theeigenvalues of (A<SUB>d</SUB>-B<SUB>d</SUB>G). Here is one example: </P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP">Ad=0.85;Bd=0.15;<BR>Q=1;R=0.2;<BR>[G,S,E]=dlqr(Ad,Bd,Q,R)</TD></TR></TABLE><P>MATLAB's response is</P><BLOCKQUOTE> <P>G=</P><P>1.1797</P><P>S=</P><P>2.3370</P><P>E=</P><P>0.6731</P></BLOCKQUOTE><P>"lqr" works analogously for continuous-time systems."dlqry" minimizes the cost function J=Sum {y'Qy + u'Ru}in which onlythe <I>output vector</I> y, and not the whole state-vector x, is weighted."dlqy" works analogously for continuous-time systems. </P> <hr><H3><A NAME="c44"></A>4.4 Kalman estimator (or -filter)</H3><P>"kalman" designs both continuous-time and discrete-timeKalman-filters. The <I>discrete-time</I> Kalman-filter is more commonly used.In this case, it is assumed that the system is given by a discrete-timestate-space model in the form of an LTI-object. The model is</P><P ALIGN="CENTER">x(k+1)=Ax(k) + Bu(k) + Gw(k) </P><P ALIGN="CENTER">y(k)=Cx(k) + Du(k) + Hw(k) + v(k)</P><P>where w is the process noise, and v is the measurement noise. Note that theLTI-object must be created by the expression</P><P ALIGN="CENTER">sys=ss(A,[B,G],C,[D,H])</P><P>Q, R, and N are the white-noise covariances as follows: </P><P ALIGN="CENTER">E{ww'}=Q, E{vv'}=R, E{wv'}=N</P><P>The Kalman-estimator is </P><P ALIGN="CENTER">x(k+1|k)=Ax(k|k-1) + Bu(k) + L[y(k) - y(k|k)] (Eq. 1)<BR>=Ax(k|k) + Bu(k) (Eq. 2)</P><P ALIGN="CENTER">x(k|k)=x(k|k-1) + M[y(k) - y(k|k)] (Eq. 3)</P><P>where</P><P ALIGN="CENTER">y(k|k)=Cx(k|k) + Du(k)</P><P>In a "two-step" Kalman-estimator the aposteriori estimate or the"measurement update estimate" - which is the estimate we usually need- is given by Eq. 3, while the apriori estimate or the "time update"estimate is given by Eq. 2. In a "one-step" Kalman-estimator Eq. 1gives the estimate.</P><P>The syntax of "kalman" is</P><P ALIGN="CENTER">[Kest,L,P,M,Z]=kalman(sys,Q,R,N)</P><P>Here, N may be omitted if it is zero. Kest is the Kalman estimator in theform of an LTI-object having [u;yv] as inputs (yv is the measurements), and[yest,xest] as outputs. M is the steady-state innovation gain or estimator gainfor a "two-step" Kalman-estimator. L is the steady-state innovationgain or estimator gain for a "one-step" Kalman-estimator. P, and Zare the steady-state error covariances:</P><P ALIGN="CENTER">P=E{[x - x(k|k-1)][x - x(k|k-1)]'} (Covariance of aprioriestimate error)</P><P ALIGN="CENTER">Z=E{[x - x(k|k)][x - x(k|k)]'} (Covariance of aposterioriestimate error)</P><P>Here is one example:</P><TABLE BORDER="1" CELLSPACING="1" BORDERCOLOR="#000000" CELLPADDING="4" WIDTH="633"><TR><TD VALIGN="TOP">A=0.85;B=0.15;C=1;D=1;Ts=0.1;<BR>G=1;H=0;<BR>s1=ss(A,[B,G],C,[D,H],Ts);<BR>Q=1; R=0.2;<BR>[Kest,L,P,M,Z]=kalman(s1,Q,R)</TD></TR></TABLE><P>MATLAB's response is </P><BLOCKQUOTE> <P>a=</P><P>x1_e</P><P>x1_e 0.12853</P><P>b=</P><P>u1 u2</P><P>x1_e -0.57147 0.72147</P><P>c=</P><P>x1_e</P><P>y1_e 0.15121</P><P>x1_e 0.15121</P><P>d=</P><P>u1 u2</P><P>y1_e 0.15121 0.84879</P><P>x1_e -0.84879 0.84879</P><P>Sampling time: 0.1</P><P>Discrete-time system.</P><P>L=</P><P>0.7215</P><P>P=</P><P>1.1226</P><P>M=</P><P>0.8488</P><P>Z=</P><P>0.1698</P></BLOCKQUOTE> <hr><H2><A NAME="c5"></A>5 Overview over functions in Control System Toolbox</H2><P>Version 4.0.1 07-Mar-1997</P><H4>Creation of LTI models</H4><P> ss - Create a state-space model.<BR>zpk - Create a zero/pole/gain model.<BR>tf - Create a transfer function model.<BR>dss - Specify a descriptor state-space model.<BR>filt - Specify a digital filter.<BR>set - Set/modify properties of LTI models.<BR>ltiprops - Detailed help for available LTI properties.</P><H4>Data extraction</H4><P> ssdata - Extract state-space matrices.<BR>zpkdata - Extract zero/pole/gain data.<BR>tfdata - Extract numerator(s) and denominator(s).<BR>dssdata - Descriptor version of SSDATA.<BR>get - Access values of LTI model properties.</P><H4>Model characteristics</H4><P> class - Model type ('ss', 'zpk', or 'tf').<BR>size - Input/output dimensions.<BR>isempty - True for empty LTI models.<BR>isct - True for continuous-time models.<BR>isdt - True for discrete-time models.<BR>isproper - True for proper LTI models.<BR>issiso - True for single-input/single-output systems.<BR>isa - Test if LTI model is of given type.</P><H4>Conversions</H4><P> ss - Conversion to state space.<BR>zpk - Conversion to zero/pole/gain.<BR>tf - Conversion to transfer function.<BR>c2d - Continuous to discrete conversion.<BR>d2c - Discrete to continuous conversion.<BR>d2d - Resample discrete system or add input delay(s).</P><H4>Overloaded arithmetic operations</H4><P> + and - - Add and subtract LTI systems (parallel connection).<BR>* - Multiplication of LTI systems (series connection).<BR>\ - Left divide -- sys1\sys2 means inv(sys1)*sys2.<BR>/ - Right divide -- sys1/sys2 means sys1*inv(sys2).<BR>' - Pertransposition.<BR>.' - Transposition of input/output map.<BR>[..] - Horizontal/vertical concatenation of LTI systems.<BR>inv - Inverse of an LTI system. </P><H4>Model dynamics</H4><P>pole, eig - System poles.<BR>tzero - System transmission zeros.<BR>pzmap - Pole-zero map.<BR>dcgain - D.C. (low frequency) gain.<BR>norm - Norms of LTI systems.<BR>covar - Covariance of response to white noise.<BR>damp - Natural frequency and damping of system poles.<BR>esort - Sort continuous poles by real part.<BR>dsort - Sort discrete poles by magnitude.<BR>pade - Pade approximation of time delays.</P><H4>State-space models</H4><P> rss,drss - Random stable state-space models.<BR>ss2ss - State coordinate transformation.<BR>canon - State-space canonical forms.<BR>ctrb, obsv - Controllability and observability matrices.<BR>gram - Controllability and observability gramians.<BR>ssbal - Diagonal balancing of state-space realizations. <BR>balreal - Gramian-based input/output balancing.<BR>modred - Model state reduction.<BR>minreal - Minimal realization and pole/zero cancellation.<BR>augstate - Augment output by appending states.</P><H4>Time response</H4><P> step - Step response.<BR>impulse - Impulse response.<BR>initial - Response of state-space system with given initial state.<BR>lsim - Response to arbitrary inputs.<BR>ltiview - Response analysis GUI.<BR>gensig - Generate input signal for LSIM.<BR>stepfun - Generate unit-step input. </P><H4>Frequency response</H4><P>bode - Bode plot of the frequency response.<BR>sigma - Singular value frequency plot.<BR>nyquist - Nyquist plot.<BR>nichols - Nichols chart.<BR>ltiview - Response analysis GUI.<BR>evalfr - Evaluate frequency response at given frequency.<BR>freqresp - Frequency response over a frequency grid.<BR>margin - Gain and phase margins</P><H4>System interconnections</H4><P> append - Group LTI systems by appending inputs and outputs.<BR>parallel - Generalized parallel connection (see also overloaded +).<BR>series - Generalized series connection (see also overloaded *).<BR>feedback - Feedback connection of two systems.<BR>star - Redheffer star product (LFT interconnections).<BR>connect - Derive state-space model from block diagram description.</P><H4>Classical design tools</H4><P> rlocus - Evans root locus.<BR>rlocfind - Interactive root locus gain determination.<BR>acker - SISO pole placement.<BR>place - MIMO pole placement.<BR>estim - Form estimator given estimator gain.<BR>reg - Form regulator given state-feedback and estimator gains.</P><H4>LQG design tools</H4><P> lqr,dlqr - Linear-quadratic (LQ) state-feedback regulator.<BR>lqry - LQ regulator with output weighting.<BR>lqrd - Discrete LQ regulator for continuous plant.<BR>kalman - Kalman estimator.<BR>kalmd - Discrete Kalman estimator for continuous plant.<BR>lqgreg - Form LQG regulator given LQ gain and Kalman estimator.</P><H4>Matrix equation solvers</H4><P> lyap - Solve continuous Lyapunov equations.<BR>dlyap - Solve discrete Lyapunov equations.<BR>care - Solve continuous algebraic Riccati equations.<BR>dare - Solve discrete algebraic Riccati equations.</P><H4>Demonstrations</H4><P> ctrldemo - Introduction to the Control System Toolbox.<BR>jetdemo - Classical design of jet transport yaw damper.<BR>diskdemo - Digital design of hard-disk-drive controller.<BR>milldemo - SISO and MIMO LQG control of steel rolling mill.<BR>kalmdemo - Kalman filter design and simulation.</P> </TD> </TR></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -