New version page

# SIU ET 438A - MATLAB CONTROL TOOBOX FUNCTIONS

Documents in this Course
Unformatted text preview:

pendix Arl Toolbox Functionspll'oAgMatlab Contrlab38a6.wp5Fall 1998bodePurposeSyntaxDescriptionBode frequency response of LTI systemsbode (sys)bode (sys , w)bode(sys1,sys2, . . .,sysN)bode(sysl,sysZ,. . .,sysN,w)bode(sys1,'PlotStylel', . . .,sysN,'PlotStyleN')[mag,phase,w] = bode(sys)bode computes the magnitude and phase of the frequency response of LTIsystems. When invoked without left-hand arguments, bode produces a Bodeplot on the screen. Bode plots are used to analyze system properties such as thegain margin, phase margin, DC gain, bandwldth, disturbance rejection, andstability.bode (sys) plots the Bode response of an arbitrary LTI model sys. This modelcan be continuous or discrete, and SISO or MIMO. In the MIMO case, bodeproduces ern array of Bode plots, each plot showing the Bode response of oneparticular I/O channel. The frequency range is determined automatically basedon the system poles and zeros.bode (sys , w) explicitly specifies the frequency range or frequency points to beused for the plot. To focus on a particular frequenry interval [wmin,wmax], setrv = {wmin, wmax}. To use particular frequency points, set w to the vector ofdesired frequencies. Use logspace to generate logarithmically spacedfrequency vectors. All frequencies should be specified in radians/sec.bode (sys 1 , sys2 , . . . , sysN) or bode (sys 1 , sys2 , . . . , sysN, w) plots the Boderesponses of several LTI models on a single figure. All systems must have thesame number of inputs and outputs, but may otherwise be a mix of continuousand discrete systems. This syntax is useful to compare the Bode responses ofmultiple systems.bode (sys 1 , ' PlotStyle I ' , . . . , sysN , ' PlotStyleN ' ) further specifies whichcolor, linestyle, and/or marker should be used to plot each system. For example,bode(sysl, 'r--' ,sys2, 'gx')t-17bodeuses red dashed lines for the first system sysl and green 'x' markers for thesecond system sys2.When invoked with left-hand arguments,[mag,phase,w] = bode(sys)[mag,phase] = bode(sys,w)return the magnitude and phase (in degrees) of the frequency response at thefrequencies w (in rad/sec.). The outputs mag and phase are 3-D arrays with thefrequency as the last dimension (see "Arguments" below for details). You canconvert the magnitude to decibels bymagdb = 20*log10(mag).Arguments The output arguments mag and phase are 3-D arrays with dimensions(number of outputs) x (number of inputs) x (length of w)For SISO systems, mag(1,1,k) and phase(l,1,k) give the magnitude andphase of the response at the frequency o* = w(k) :mag(1,1,k) = lfi(7co1)lphase(1,1,k) =Zh(jgDx)MIMO systems are treated as arrays of SISO systems and the magnitudes andphases are computed for each SISO entry h, independen tly ( h, is the transferfunction from input _/l to output j). The values mag (i j , k) and phase (i ,j , k)then characterize the response of h, at the frequency w(k):mag(iJ ,k) = lhg(ja*)lphase(1J ,k) = [email protected])Example You can plot the Bode response of the continuous SISO system2F/(s) = -s- + 0' I s-+ 7'5 -s4 + 0. l2s3 + 9s21- 18bodeby>,ali:I'.1:::I10>> g = tf([l o.r 7.5], [1 o.rz I 0 0]);> bode(g)Bode Diagrams1ooFrequency (rad/sec)1otTo plot the response on a wider frequency range, e.g., from 0.1 to 100 rad/sec.,rype> bode(g, t0. 1 100))1- 19bodeYou can also discretize this system using zero-order hold and the sample timeZ" = 0.S second, and compare the continuous and discretized responses by:" gd = c2d(g,0.5)> bode (g , 'r' ,9d , 'b- - ')Bode Diagrams-100-1s0-200-250-3000-50(IloEc.-x'noEc(Lio-'1ooFr€quency (radlsec)AlgorithmFor continuous-time systems, bode computes the frequency response by evalu-ating the transfer function F1(s) on the imaginary axis s - jto. Only positivefrequencies o are considered. For state-space models, the frequency responseisD+ C(ja- ,q-L A, co ) 0When numerically safe, .4 is diagonalizedfor maximum speed. Otherwise, .4is reduced to upper Hessenberg form and the linear equation (ja - A) X = Bis solved at each frequency point, taking advantage of the Hessenberg struc-L-20bodeture. The reduction to Hessenberg form provides a good compromise betweenefficiency and reliability. See [ll for more details on this technique.For discrete-time systems, the frequency response is obtained by evaluatingthe transfer function H(z) on the unit circle. To facilitate interpretation, theupper-half of the unit circle is parametrized as:"= !'7", o ( ol( to- = *lswhere T, is the sample time and crrr is called the Nyquist frequency.Theequivalent "continuous-time frequency" o is then used as the x-axis variable.Because H("J't ") is periodic with period 2<rrry, bode plots the response onlyup to the Nyquist frequenry ot. If the sample time is unspecified, the defaultvalue 7, = 1 is assumed.Diagnostics If the system has a pole on the ,l'o axis (or unit circle in the discrete case) andw happens to contain this frequency point, the gain is infinite, jol - A issingular, and bode produces the warning message:Singularity in freq. response due tojw-axis or unit circle pole.See Also ltiview LTI system viewernyquist Nyquist plotnichols Nichols plotsigma Singular value plotfreqresp Frequency response computationevalfr Response at single complex frequencyReferences [] Laub, A.J., "Efficient Multivariable Frequency Response Computations,"IEEE Transactions on Automatic Control, AC-26 (1981), pp. 407-408.L-21feedbackPurposeSyntaxDescriptionFeedback connection of two LTI modelssys = feedback(sysl,sysZ)sys = feedback(sys1,sys2,sign)sys = feedback(sysl,sysZ,feedin,feedout,sign)sys = feedback(sysl , sys2) returns an LTI model sys for the negative feed-back interconnectionThe closed-loop model sys has u as the input vector and y as the outputvector.The LTI models sysl and sysZ must be both continuous or both discrete withidentical sample times. Precedence rules are used to determine the resultingmodel t5rpe (see p.2-3).To apply positive feedback, use the syntaxsys = feedback(sysl , sysZ, +1)By default, feedback (sys I , sys2) assumes negative feedback and is equiva-lent to feedback(sys1 , sys2, -1) .Finally,sys = feedback(sysl,sys2,feedin,feedout)L-71feedbackcomputes a closed-loop model sys for the more general feedback loop:SYSThe vector feedin contains indices into the input vector of sysl and specifieswhich inputs u are involved in the feedback loop. Similarly, feedout specifieswhich outputs y of sysl are used for feedback. The resulting LTI model syshas the same

View Full Document Unlocking...