Popular in Course
Popular in Mechanical Engineering
verified elite notetaker
This 114 page Class Notes was uploaded by Jada Daniel on Wednesday September 23, 2015. The Class Notes belongs to MEM255 at Drexel University taught by Staff in Fall. Since its upload, it has received 49 views. For similar materials see /class/212406/mem255-drexel-university in Mechanical Engineering at Drexel University.
Reviews for IntroductiontoControls
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/23/15
MEM 255 Introduction to MATLAB Professor Kwatny Co nte nts MEM 255 Introduction to MATT AR 1 Cnntpnt 1 Rashs 2 Command Window 2 m les 7 scripts and lnr nn 2 Basic Data Structures 7 vectors matrices and I 1 39 1 3 Vector 3 Matrices 4 l ample39 5 Polynomials 5 Basic Plotting 6 Simple Line Plots 6 Frequency Domain Modeling 7 Complex Number 7 TransferFunc nn 8 Creating Transfer Functions 8 Converting between Form 8 Laplace Transforms 9 Analysis Tool 9 RootT mu 9 Rode lO Nyquist 10 150 Tool amp LTl Viewer ll State Space Models 13 Converting between State Space and TransferFunction Objects 14 Computing Step Responses 15 r i c 16 39g 39 amp 39g 17 Chain oleiree Iner a I7 Antenna Positioning V1 fem I9 20 Solving Ordinary Differential Fqllatinns MEM 255 MA TLAB Notes Professor Kwatn y Basics These notes provide a short guide to the minimum MATLAB knowledge required for MEM 255 There are online tutorials in the MEM lab Of course there is no substitute for spending time using the software MATLAB Basics Command window vectors functions plotting polynomials matrices complex numbers printing mfiles help Modeling representing transfer functionsstate space models creating LTI objects with 5 tf zpk ssdata tfdata zpkdata Laplace transforms basic tools laplace ilaplace residue PolynomialRational Function manipulation poly roots conv residue Conversions ss tf zpth thSSSSZZp ssth Block Diagram manipulation series parallel cloop feedback Time response stepimpulse lsim Frequency response rlocusbode nyquist System Analysis Combo s sisotool ltiview State space manipulation performing similarity transformations eig canon Command Window When you start MATLAB the Command Window opens A command can be typed at the prompt and it is executed upon pressing Enter A MATLAB session generally consists of entering and executing a sequence of commands When you exit MATLAB the entire history of the session is lost unless you speci cally save it using the function diary To get help 7 1 If know the name of the command you are interested in simply type help name at the prompt Ifyou don t know use a lookfor with a keyword you may get more help than you want 2 To browse for functions in various categories go to the help window from the help menu 3 If you are online complete up to date help and detailed documentation is available from the MathWorks web site Simply choose help desk from the help menu m les scripts and functions An m le or script le is a simple text le where you can place a sequence of MATLAB commands When the le is run type the le name in the command window and press Enter MATLAB reads the commands and executes them All m le names must end with the extension m eg plotm If you create a new m le with the same name as an existing m le MATLAB will choose the one that appears rst in the path order help path for more information To see if a lenamem exists type help f ilehame at the MATLAB prompt You can create m les with any text editor The editor medit supplied with MATLAB is a good one When entering a MATLAB command such as roots plot or step an m le with inputs and outputs is executed These m les are similar to subroutines in programming languages in that they have inputs parameters that are passed to the m le outputs values that are returned from the m le and a body of commands that can contain local variables MATLAB calls these m les functions You can write your own functions using the function command MEM 255 MA TLAB Notes Professor Kwatn y The new function must be given a lename with a m extension This le should be saved in any directory that is in MATLAB s search path The rst line of the le must be in the form function outputloutput2 lenameinputlinput2input3 A function can have any number of input and output variables Basic Data Structures vectors matrices and polynomials Vectors Vectors are easily de ned using spaces or commas EDU al 2 3 4 a 1 2 3 4 EDU b1234 b Large specially structured matrices can be constructed using the syntaX fir st index las t EDU c0 2 20 c Vectors of the same length can be added EDU ab EDS 2 4 6 8 Vectors de ned as above should be considered row vectors Column vectors can be de ned using the semicolon EDU fl234 f wmw 4 Row vectors can be transposed to obtain column vectors and viceversa EDU 339 ans mme MEM 255 MA TLAB Notes Professor Kwatn y Matrices Matrices can be de ned in a similar way to vectors With rows separated by semicolons EDU Al 2 34 5 67 8 9 A l 2 3 4 5 6 7 8 9 EDU BOl000l B O l O O O l Matrices of compatible dimensions can be multiplied EDU BA ans 4 5 6 7 8 9 They can b raised to powers EDU A 3 EDS 468 576 684 1062 1305 1548 1656 2034 2412 Element by element multiplication of square matrices is accomplished by the or A operator For example EDU A A 3 ans 1 8 27 64 125 216 343 512 729 cubes each element of A Matrices can be transposed EDU B 39 O O l O O 1 Table 1 Functions to create matrices Function Returns diag matrix With speci ed diagonal elementsor extracts diagonal entries eye iden ity matrix ones matrx lled W th ones rand matr x lled W th random numbers zeros matr x lled W th zeros lins ace row vector of 11near spaced elements MEM 255 MA TLAB Notes Professor Kwatn y logspace row vector of logarithmically spaced elements Example gtgt eye 4 EDS 1 o o o o 1 o o o o 1 o o o o 1 Polynomials A polynomials can be represented by a vector containing its oredered coef cient list The polynomial 34 233 432 s3 is de ned EDU polyl 1 2 4 1 3 polyl 1 2 4 1 3 and the polynomial is de ned EDU polyZ l O l polyZ 1 o 1 Certain MATLAB functions interpret 71 1 dimensional vectors as n th order polynomials These include polyval roots conv and deconv Polyval can be used to evaluate polynomials root 5 determines the roots of the given polynomial conv multiplies two polynomials and deconv divides two polynomials EDU conv polyl polyZ ans l 2 5 3 7 l 3 EDU X R deconv polylpoly2 Notice that this last result states s42s34s2s3 2 s 2 s 2s 3 2 3 1 3 1 The characteristic polynomial of a square matrix can be obtained EDU Xpoly A X MEM 255 MA TLAB Notes Professor K watn y 10000 150000 l80000 00000 Allowing us to compute the eigenvalues of the matrix EDU roots X EDS 161168 lll68 00000 Basic Plotting Simple Line Plots The basic form is de ne data vectors x andy then plot x y gtgt Xdata0l 23 45 ydatal2332 1 gtgt plot Xdataydata You can also create subplots gtgt Xllnspace 0 2p1 gtgt subplotl2l gtgt plotxs1nX ax150 2p1 715 15l tltle39slnx39 gtgt subplotl22 gtgt plotxs1n2X ax150 2p1 715 15l tltle39sln2x39 MEM 255 MA TLAB Notes Professor Kwatny Slngtlt SW20 1 z 1 z 1 1 5 D 5 D U 0 5 D 5 1 1 1 E 2 4 6 1 I 2 4 6 Frequency Domain Modeling Complex Numbers Note that in MALAB both 139 and j are predefined as J For instance compute gtgt j 2 ans 71 gtgt 1 32 ans 707071 07 7 1 However you can redefine them as something else Once you do the original definitions are gone gtgt j 5 j 2 ans 25 A complex number is ordinarily expressed in rectangular coordinates z x iy Where x is the real part and y is the imaginary part or alternatively in polar or Euler notationz pe Where p is the magnitude and 6 is the angle Table 2 Operations on complex numbers Function Returns imag imaginary part of a comnle number real real part of a complex number abs magnitude ofa comnle number angle angle ofa comnle number conj conjugate of a comnle number Example gtgt Zll MEM 255 MA TLAB Notes Professor Kwatn y 10000 10000i gtgt absz EDS 14142 gtgt anglez180pi EDS 4 5 Transfer Functions Creating Transfer Functions 1 numerical using the functions tf or Zpk 2 symbolic EDU numf10l 2 EDU denfl 6 9 EDU Ftfnumfdenf Transfer function 10 s 20 s 26s9 EDU GZpk 2 3 3 10 Zeropolegain 10 52 S3 2 EDU Stf 39539 EDU H10s2 s3 2 Transfer function s 26s9 Converting between Forms EDU FFtfG Transfer function 312273 EDU GGzpkH Zeropolegain 10 52 MEM 255 MA TLAB Notes Professor Kwatn y Laplace Transforms The symbolic capabilities in MATLAB allow computation of Laplace transforms and their inverses Unfortunately the simplification tools are not the best gtgt syms a w t s gtgt f1expats1nwt gtgt F11ap1acef1 F1 w sa 2w 2 gtgt f111ap1aceF1 f1 w74WA2VlZVWXW a12 4W 2 12teXpa71274w 2 12t stf39s39 gtgt 5Y5105S4s2s 2s5 Transfer funct1on 2 40 s s 3 3 s 2 7 s 10 gtgt numdentfdatasys39V39 gtgt rpkres1duenumden 78571 147481 78571 147481 57143 p 05000 217941 05000 217941 20000 k 1 Analysis Tools Root Locus gtgt stf 39s39 H10s20s 26s Transfer funct1on s Transfer funct1on s 2 6 s 9 gtgt rlocusH gtgt Gs4 s Transfer funct1on gtgt rlocus G KH W255 AMTLAB Notes Profemor Kwamy mam RamLacus y y y y y yi Svstem ummem 33er mass 2 731 oussm Dampmg new evsham u ryequencv Hadsec 317 as ns 1 9 Va 7 75 74 72 1 Rea Axxs Put the pointer on any point on the root loci and click to obtain data Bode EDU bode H Nyquist H nyqu15t Magmtude 15 Phase 189 m w Eude Dwagrams mm W m m39 Frequency radsec MEM 255 MA TLAB Notes Professor Kwatn y Nyquist Diagrams i m UKM in Viii 9 Imaginary Axis Vi 705 O 05 1 i5 7 25 Real Axis SISO Tool amp LT Viewer Here are a couple of tools that combine various functions into a simple to use package gtgt G 51 5A22 12 2s4 Transfer function s 2 2 s 4 gtgt Cs2 s Transfer function gtgt sisotool gtgt ltiView gtgt GCL2CG 12CG Transfer function 2s 5lOs 424s 3325 2l6s s 66s 522s 440s 348s 2l6s MEM 255 MA TLAK Note Ram Laws Em C opemaap Bade Em C m 2 u 1 M m m NW stamewaap 7 PM 122 deg 4 m usaavadsec u 2 3 73 A m 4 7 mquot 1339 Ram gqumoamsec s epxespme as m m as 5 U5 s m as u m 5 1 5 2n 2 me see memor mey MEM 255 IWATLAB Nam memnr Kwably mum magmm L magmarv Am u 2 Rea Am am man 51 Magmae cm W giie u Phaia den n equency Ind50 State Space Models Smte space models can be de ned using the Jnction ss gnu AE 1 mm m 1 73 72 71 gnu Elll gnu c1 2 1 gnu nn gnu FsssSAECD x1 x2 x3 Xi H 1 u x2 u u 1 x3 73 72 71 h ul x1 1 x2 1 MEM 255 MATLAB Notes Professor K warn y X3 1 c X1 X2 X3 y1 1 2 1 d u1 y1 O Continuous time model Converting between State Space and Transfer Function Objects A state space model can be converted to a transfer function model using tf EDU thtf F55 Transfer funct1on 4 5A2 5 5 35 2253 Transfer function models can be converted to state space using ss gtgt G 51 5A22 12 2s4 Transfer funct1on SAZ254 gtgt GssssG X1 X2 X1 2 1 X2 4 0 b u1 X1 1 X2 0 c X1 X2 y1 1 025 d u1 y1 O Cont1nuousit1me model Gss is an LTT object You can extract the data using ssdata The function ssdata can be applied to either G or Gss gtgt ABCDssdataGss MEM 255 MA TLAB Notes Professor Kwatn y 10000 02500 0 gtgt ssdataG ans The functions ss2tf and tlZss are used to transform between data as opposed to LTI objects For example EDU num den SSth A B C D num 0 40000 10000 750000 den 10000 10000 20000 30000 Computing Step Responses The functions 5 tep and impul se allow easy computation of step and impulse responses More general input responses can be obtained with 1 sim EDU y1t1stepG or stepGss EDU p10tt1y1 MEM 255 MA TLAB Notes Professor Kwatn y For example EDU y2 t25tep F55 EDU plott2y2 Notice that the system is unstable To see this check the transfer function in pole zero form EDU szkzpkF55 Zeropolegaln Sl25 5l276 5 2 027575 2352 m x H Interconnections The basic MATLAB tools for interconnecting LTT objects are the functions parall el serie s and feedback The following example illustrates the use of s eri es and f e e db a c k EDU stf39539 EDU 5y5l5l 5 252 Tran5fer function EDU 5y5225 55 MEM 255 MA TLAB Notes Professor K warn y Transfer function EDU sys34 s4 Transfer function 4 EDU sys4feedbacksyslsys2 Transfer function s s 38s 29s10 EDU sys5seriessys4sys3 Transfer function 224s20 s 412s 34ls 246s40 Notice that the last step could have been accomplished using multiplication ie EDU sys 4 sys3 Transfer function 224s20 5A412 s 34ls 246s40 Also these commands work with state space as well as transfer function objects Eigenvalues amp Eigenvectors The simplest way to compute eigenvalues and eigenvectors is to use the function eig in MATLAB For large systems the function eig 5 might be a better choice because it computes only the rst k user speci ed eigenvalue 7 eigenvector pairs Chain of Three Inertias mj l kx2 x1 cfc1 mj 2 kx2 x1kx3 x2 cfc2 M563 kx3 xz cfc3 MEM 255 MATLAB Notes Professor K warn y 92 EDU A0 0 0 1 0 00 0 0 EDU e1gA ans 0 5000 165831 0 5000 165831 0 5000 086601 0 5000 086601 0000 10000 EDU Vee1gA V Columns 1 through 4 01954 005891 01954 03909 011791 03909 01954 005891 01954 00000 035361 00000 00000 070711 00000 00000 035361 00000 Columns 5 through 6 05774 04082 05774 04082 0 5774 04082 0 0000 0 4082 0 0000 0 4082 00000 0 4082 Columns 1 through 4 05000 165831 0 0 0 0 0 0 0 0 0 Columns 5 through 6 0 0 0 0 0 0 0 0 00000 0 0 10000 1 o o o o o o C C 05891 11791 05891 35361 70711 35361 0 05000 165831 3 lt3 CD lt3 2k k 0 3 lt3 CD lt3 CD 0 1 00 0 0 0 0 11 1 0 oo oo lt 00x1 0xZ 03 001171 0pz 03 1 0 01 2 25001 04330 00001 00000 25001 04330 50001 00000 00001 00000 50001 00000 0 0 0 05000 086601 0 0 0 1 1010011001 25001 00001 25001 50001 00001 50001 0 05000 086601 0 0 Professor K warn y MEM 255 MATLAB Notes 4V Low frequency k W m W m gt lt high frequency Antenna Positioning System The antenna positioning system shown in the figure has transfer function 5 S ss1s5 33 632 s and a state space model one of many 7 but this one has the states indicated in the block diagram x1 5c 0 1 0 x1 0 x20 11x20uy100x2 x3 0 0 5 x3 5 x3 Load Dynamics Drive Electronics drive motor gear train Kinematics dish 5 xs 1 x2 x1 u 4 4 4 l 4 35 31 S Position Angular Command Torque VEIDCitY Position Signal EDU A0 1 00 71 10 o 75 EDU VeelgA V 10000 07071 00485 0 07071 02423 0 09690 MEM 255 MA TLAB Notes Professor Kwatn y Solving Ordinary Differential Equations MATLAB provides a large number of tools for solving ordinary differential equations In general solving ODEs is complicated because any situation can have unique characteristics that require special treatment Nevertheless a MATLAB function that has very broad applicability is the differential equation solver ode45 The problem to be solved is this Let x be the ndimensional state vector and suppose the state equation has the general form 5c f xt with a speci ed initial condition xt0 x0 We wish to numerically compute the solution xt on the time interval to S t S If using the function ode45 The differential equation is integrated from to to If by ODE45 ODEFUN TSPAN YO ODE45 ODEFUN TSPAN Y00PTIONS where TSPAN T0 TFINAL YO is the initial condition Function ODEFUNty returns a column vector corresponding to fty Each row in the solution array Y corresponds to a time returned in the column OPTIONS is an argument created With the ODESET function See ODESET for details Replaces default integration properties by values defined in ODESET For example consider the Euler equations that describe the rotation of a rigid body about its fixed center of mass 59 xzxs Jb2 x1x3 x3 05x1x2 with initial conditions x1 0 0 x2 0 1 x3 0 l The vector x is the body angular velocity vector function dy rigidty dy zeros3l 5 a column vector dYl Z y2 BN3 dy2 Z Zyl BN3 dy3 Z Z0 51 yl y2r gtgt options odeset39RelTol39leZ439AbsTol39 leZ4 leZ4 leZ5 gtgt TY ode45rigid O 12 O l loptions gtgt plotTYl 39Z39TY2 39Z39TY3 3939 20 MEM 255 MA TLAB Notes Professor Kwatn y 39quotquot 21 MEM 255 Introduction to Control Systems Solving State Equations Harry G Kwatny Department of Mechanical Engineering amp Mechanics Drexel University Outline Goal Introduce the concepts and terminology that underlay the state space tools implemented in MAT LAB and similar software 0 Problem de nition 0 Solving state space equations via Laplace transforms 0 Solving state space equations in the time domain I Basic properties I The homogeneous equationstate transition matrix I Variation of parameters formula State Space Models state inputut W gt System output y t gt The diffrential equation or state space model is 560 14960 3 I state equation y t Cxt Du t output equation X0 x0 initial condition The state space model describes how the input u t and the initial condition affect the state xt and the output y Solving Linear State Equations XAxBul xeR ueRm givenxlox0ul forlzlo ndxlf0rt210 x Ax b b t 2 Bu forced or nonhomogeneous X Ax homogeneous Solving State Equations Via the Laplace Transform szxBu yCxDu A xB u sXs x0 AXSBUS yC xD u YsCXsDUs Xs 2 SI A71x0 sI A71 BUS yscs1A 1x0 CsI A IBDUS The Resolvent adjSI A N nxn matrix detsI A detsI A adj s1 A n x n matrix of cofactors SI A71 Recall the n2 minors of an n x n matrixM are de ned as the i j minor M y is the determinant of the n l x n 1 matrix obtained from M by deleting the 139 row and j column The i39 cofactor is Ci 2 lijM 1 Basic properties x1t x t sol ns of homog cl CZ constants U xt 01x1 t sz2 I is a sol n of homog x1t x2 I sol ns of forced U xt x1 I x2 I is a sol n of homog xP t any sol n of forced xh t any sol n of homog U xt xh t xp t is a sol n of forced The Homogeneous Equation Let us rst solve the homogeneous equation Axt xt0 x0 Strategy assume a sol39n and see if it works Assume a solution in the form of a power series xta0 a1 t t0a2 t t02ak t t0k 3 ctgta12a2t t0kakt toquot 1 AxtgtAa0 Aa1 t tOAa2t t02 Aakt t0k Compare coef cients of like powers of t to The Homogeneous Equations 2 a1 Aa0 a1 Aa0 1 1 a2 514a1 a2 5142a0 3 1 1 ak Aak1 ak Aka0 k k xta0 Aa0t t0A2a0t to2Aka0t t0k IAl t0A2t t02AkZ t0k a0 The Homogeneous Equation 3 Set I t0 xt0 x0 to obtain 30 x0 3 xt1At t0A2t t02 Akt t0k x0 Recall the series expansion for the scalar exponential 610quot 1at t0a2t t02 akt t0k De ne the matrix exponential 6W 1At t0A2t t02 Akt t0k so that Matrix Exponential eA IAzlA2z2 iAkzk 2 k Some properties 16A AeAz eAzA dz eAzeiAz I 6A1 A eB are if and only ifAB BA 71 7A2 e e Variation of Parameters Formula Recall any sol39n of forced satis es xv xi r xp r where xh t eA c for constant vector 0 satisfies homog xp t is any particular sol39n of forced We seek xp Assume the form xp t eA c Variation of Parameters 2 xp Axp Bu and imp AeAtcreAtcz gt c39t e AtBtut gtct kw Ige ArBrurdr Now xt we HAIL warp 1011 eA c L eAltHgtBrurdr Variation of Parameters 3 Finally xt0 x0 gt x0 eA390c gt c e A 0 x0 x t eAH x0 J eAHBIu 16 CDtt0x0LDtrBrurdr Recall with to 0 Xs s A71x0 sI A71 BUS By comparison 5 em 2 SI A71 Example Mathematlca 1 a 0 mm MatrixExnlJ 2 1t H Matrixrarm 2 n n m1ffhl atrixForrn o a plus we le2 21et o 1 1 u u In4 LaplaceTransfomMatrixExpll 2 1t t s H Matrixli om 2 u n m4I39I39Matrix Forrn Example MATLAB gtgt Al O OO 2 l2 O 0 gtgt syms t gtgt expmtA expt exp2t2exptl 2expt2 gtgt laplaceexpmtA lSl ls Z 2s lls 25 1 2s O 0 exp2t l2l2exp2t O 1 0 0 lSZ l2Sl2S2 0 15 Summary 0 State transition matrix 0 Matrix exponential Resolvent 0 Variation of parameters formula MEM 255 Introduction to Control Systems Review Basics of Linear Algebra Harry G Kwatny Department of Mechanical Engineering amp Mechanics Drexel University Outline 0 Vectors Matrices MATLAB Advanced Topics Vectors A vector is a onedimensional array of scalarelements real or complex numbers x1 x2 columnvectorx rowvectoryy1 yZ yn xn Vectors of equal dimension can be added elementwise x ablt3 x 1 17 iln Vectors can be multiplied by a scalar x 0m ltgt x Dra Vectors can be transposed Inner Product amp Norm The inner product of two ndimensional vectors x y is x y 21xiyi for column vectors xygt xTy for row vectors ltxy ng The Euclidean norm or length of a vector x is llxll W 211163 Other norms or length measures are also just useful 2quot llxlll xila llxllw maxIX Linear Combinations of Vectors Suppose 01139 lp is a set ofscalars and xx 139 lp is a set of column or row vectors then we de ne a new vector y via the linear combination ya1x1a2x2apxp for columns yl x1 xpl 01 39 up yn x1n xpl A set ofp vectors x i lp is linearly dependent ifthere exists a nontrivial set of constants 051139 1 p such that alxl thx2 zszp 0 otherwise it is linearly independent A set of linearly independent ndimensional vectors contains at most 11 vectors Matrices o A matrix is a 2dimensional rectangular array of elements an 5 12 39 39 39 am W1 FOWS aml 39 39 39 arm rt columns Sometimes we write A ay 0 The elements are called scalars they are usually real or complex numbers 0 A matrix with one row m 1 is called a row matrix or row vector A matrix with one column n l is called a column matrix or column vector Algebraic Operations o Equality two matrices of the same size AB are equal written A B if their corresponding elements are equal at bU forlSiSmlSan o Matrices of the same size can be added and subtracted Matrix addition and subtraction are performed elementwise ABC aljbljclj A BCcgtaU bycy 0 Any matriXA av can be multiplied by a scalar a 011 only 0 An m X n matriXA can be post multiplied by an n X q matriXB to produce an m X q matrix C CAB 0112 a b H zita X X X X Multiplication X X X X X X X bu gtlt c I X biz II bu an 6 22 6 23 6 24 bzz 4 b 022 all an an an b Zkla2k k2 32 b 42 Transpose The transpose of an m x n matrix is the n x 7 matrix obtained by interchanging rows and columns an and an 12 aln 12 and A AT aml aml amn aln arm A matrix is symmetric ifAT A The following rules obtain ABT BTAT ABT ATBT Determinant o The ijth minor My ofa square n X n matrixA is the n l X n l submatrix of A obtained by eliminating row i and column j o The determinant of a square matrix is de ned recursively The determinant of a le matrix is deta11 all The determinant of a n X n matrix is de ned by the expansion detA Egalij for any i l2n where yU is the cofactor yU 41 detMl Note for any 1quot means expand along any row The same result is obtained by expanding along any column Properties of Determinants I multiply any single row or column of A by scalar D to getA detA adetA I interchange any two rows or columns ofA to get A detA 7 det A I add multiple of any row or column to another row or column to get A detA detA I detAT detA detAB detAdetB I for AC square A B det det A det D 0 D I forA nonsingular A B 1 det detAdetD7CA B C D Matrix Inverse An identity matrix of size n is the square matrix with n rows and columns 107770 01 17 0 077701 The adjugate of a square matrixA is de ned as the transpose of the matrix of cofactors T W ml It can be shown thatAade detA1 adJA I detA A square matrixA with detA 0 is called nonsingular for a If detA 0 we haveA nonsingular matrix we can de ne the inverse 7 ade Aquot 7 detA 2AAquot 1 A EA 1 Rank Consider an m X n matrix A o The number of linearly independent rows of A equals the number of its linearly independent columns 0 The rank of A is the number of its linearly independent rows or columns 0 If A is a square matriX of size n rankA n cgt detA 0 MATLAB Basie Operations Addition A and B must have the same size unless one is a scalar A scalar can be added to a matrix of any size Subtraction A and B must have the same size unless one is a scalar A scalar can be subtracted from a matrix of any size Matrix multiplication For nonscalar A and B the number of columns ofA must equal the number of rows of B A scalar can multiply a matrix of any size Slash or matrix right division BA is roughly the same as BinvA More precisely BA A39B3939 Backslash or matrix left division lfA is a square matrix AB is roughly the same as invAB except it is computed in a different way MATLAB Basie Operations quot Matrix power Xquotp is X to the power p if p is a scalar If p is an integer the power is computed by repeated squaring If the integer is negative X is inverted first 39 Matrix transpose A39 is the linear algebraic transpose of A For complex matrices this is the complex conjugate transpose 39 Array transpose A39 is the array transpose of A For complex matrices this does not involve conjugation Note The slashbackslash operations are the better than inv to solve linear equations MATLAB Basic Functions norm matrix or vector norm rank matrix rank det determinant trace sum of the diagonal elements inv matrix inverse Applications of Matrices Matrices are important in many applications One of the most important is the solution of sets of simultaneous linear equations allxl azzxz quot39a1n n b1 39 AxbifdetA 03xA 1b anlxl arile 39 quotannxn b2 Another application is in the solution of sets of simultaneous linear ordinary differential equations for example equations like ij cyky pyaygt can be putinthe formicAxbt L94 CvBy ht where A is a properly de ned square matrix and x b are properly de ned column vectors Similarity Transformations Sometimes it is useful to solve the equations in a coordinate system that is different from the original problem formulation Any square nonsingular matrix T can be considered a transformation matrix Linear coordinate transformations of column vectors are accomplished Via transformations x TE f T 71x For example under such a transformation x Ax bt 3 f T IATfT 1bt Matrices transform under a change of coordinates according to A7 T IAT This is called a similarity transformation Special Matrices Similarity transformations are used to transform matrices into a variety of special forms when possible Among these are a11 0 a11 arz aln a 0 a a diagonal 22 upper triangular 22 2quot 0 anquot 0 0 0 an 0 0 0 0 0 1 lower companion f 391 391 f 0 0 0 0 0 l anl anZ gt gt a Advanced Topics Defer EigenvaluesEigenvectors Functions of Matrices CayleyHamilton Theorem Singular Values Summary 0 Vectors Basic definitions amp operations linear dependentindependent sets Matrices Definitions Algebraic operations Determinants Rank Inverse Similarity transformations amp special matric forms MATLAB functions MEM 255 Introduction to Control Systems Working with Block Diagrams Harry G Kwatny Department of Mechanical Engineering amp Mechanics Drexel University Outline Block diagrams as an aid in model building Working with linear SISO blocks building system transfer functions MATLAB tools General nonlinear MHVIO blocks building simulation models SIMULINK Example Cruise Control Prelimina Example MagLeV The vertical support via attracting magnets is inherently unstable since attractive forces decrease with air gap so a small disturbance from equilibrium causes the vehicle to either clamp to the rail or fall Thus a feedback control is employed using the magnet excitation voltage to stabilize the motion and control the air gap and vehicle position Prelimina Example Ma accelerometer and low pass lter disturbances vehicle C 1 39 614X10 553410gtlt10 4v27620X10 2s71 5 gap sensor and approximate differentiator Three Basic Interconnections Series Connec un 7 amp 115 Uv G2SYSampYS Yv 1G2xG x Summing Junction Linearity Example Cont d i 1 G3G2 1G3G2 G1G2 GOGle gt 1G3G2 G1G2 1G3G2 GIG2 1G3G2 1 Example Platform Rate Controller 1 Find transfer function from command to 10s 2 Find transfer function from disturbance to 10s Exam le Cont d 5 Example Cont d Using MATLAB The MATLAB functions series sys seriessyslsysZ parallel sys parallelsyslsysZ feedback sys feedbacksyslsysZ or sys feedbacksyslsyszsign do the algebra for you General syntax works for MIMO systems More General Block Diagrams as a Modeling T001 Prelimina Example Hybrid Drive Prelimina Example Hybrid Drive Simulink Step StateSpace Transfer Fcn VA Scope 39 Sine Wave To Workspace Signal Generator SAS Animation Simulink Diagram gm ProPac Code genera Ll IIIIIIII 39IT Summary Linear 8180 system block diagrams 0 Basics of block diagram algebra 0 Using MATLAB 0 General block diagrams 0 Modeling with Simulink MEM 255 Introduction to Control Systems Review Complex Numbers Harry G Kwatny Department of Mechanical Engineering amp Mechanics Drexel University Outline Definition amp Representation Basic Properties Euler s Formula Algebraic Operations Functions of a Complex Variable MATLAB Functions Complex Numbers 0 A complex number is de ned as s xjy orxz39y where l l or z39 l l is the imaginary operator and x y are real numbers I o x is the real part ofs x Res y is the imaginary part ofs y Im s s 7 plane o p de ned byx pcosQ y psinQ are called the magnitude and angle of s respectively Note p s lx2 yz 0 tan 1yx o 3 x j y is called the complex conjugate of s Basic Properties of Complex Numbers s Res 2 Ims 9 Euler 5 Formula It is easy to prove the fundamental relationship To see this set At9cost9jsint9 We can derive and solve a differential equation forA sint9jcost9jcost9jsint91A 7 1219 3 lnA 119 c where 0 1s a constant of integration 3 A ej c ej ec To determine 0 evaluate 8085 cost9 jsint9 at 9 1 3ecl3c0 Polar Representation Consider the complex number s s xjy pcoslt9 jpsin 9 pej g rectangular form s x jy polar form s pej g Many computations including multiplication and division are much easier to do in polar form Algebraic Operations Consider two complex numbers s1x1jy1 s2 xzjy2 addition s1 s2 x1x2jy1y2 multiplication sls2 x1x2 y1y2 j x1 y2 xzyl 2 sls x12 yl2 division s 1 s li xlxz y1y2 jx1y2 x2J 1 2 2 2 szsz x2 y2 Functions of a Complex variable A function F of a complex variable s can be thought of as a mapping from one complex plane splane to another Fplane The function F is analytic at a point so the splane if its derivative dFds exists at all points in a neighborhood of so The function F is called a rational function if it is the ratio of two polynomials in s eg 1173 sls 2 s2sz9 m Singularities lfa function Fs is not analytic at a point so then s0 is a singular point lfa function F s is not analytic at a point so but is analytic at every other point in a neighborhood of s0 then s0 is an isolated singular point Example Fs 1 has an isolated singular point at s 0 s If F s is a rational function then the only singularities are the roots of the denominator called poles MATLAB Functions Function Returns imag imaginary part of a complex number real real part of a complex number abs magnitude of a complex number angle angle of a complex number conj conjugate of a complex number Advanced Topics Defer Cauchy s Residue Theorem Principle of the Argument Summary Complex numbers I Rectangular and polar forms I Basic algebra Euler s formula Functions of a complex variable I Rational functions I Singularities amp poles MATLAB tools MEM 255 Introduction to Control Systems Transfer function to state space Harry G Kwatny Department of Mechanical Engineering amp Mechanics Drexel University Outline Problem de nition transfer function to state space 0 Companion form I Two methods I Example Hand calculation MATLAB Diagonal Form Problem De nition Given a transfer function G S bmi bm7139 1bls 70 a s an71s alsa0 Find a set of matrices A B C D such that Gs csI A 1 31 The answer as we will see is not unique We will consider mltn several approaches Note we can always assume m n then allow 7quot 0b 0 ml Companion Form Consider the inputoutput relation m mil ms bmj bm1 b1sb0 s an71s alsa0 squot an71s Ha1sa0Ysbmsquot39 bm71sm 1b1sb0Us 115 yquot anilym l aly aoy bmu39quot bmiluOH by bou We need to replace this nth order differential equation by a system of rst order equations in the form i Ax Bu y Cx Du Method A 1 u 1 bsmb Sm71 39bSb shra s 1 113 a0 391 1 0 Consider the auxiliary system 2 anilz 1 611239 aoz u The output y can be obtained from y bmzm bmilzm 1 11239 boz Now introduce the de nitions x1 2 x2 x1 Z39 39 nil x x 1 z Method A 2 The auxilliary equation reduces to first order ie 5cquot an71xn alx2 a0x1 14 Also the output can be written in terms of the states y bnzquotbnilzquot 1 1712 1702 2 bquot u an71xn alx2 a0x1 ben 1712c2 box1 2 b0 bna0x1bn71 bnanilxn bnu Method A 3 0 1 0 0 0 0 E A E 0 b 0 0 0 1 0 a0 an 2 anil 1 C bo bna0 7 1 1 bnan17 D 2 bn Method B 1 First define n state van39ables x1 x2 xn x1 y oclu x2 x1 a2u x Xnil 06n1l Sequentially use these definitions to eliminate y c 9 n Method B 2 y an71ynilgt 39 a1y aoy bmuW bm71um71gt 1715 b0u x101 a1uquotgt am xf H alu H 11X391 015 a0 x1 0611 bmuW bm71um71gt qu bou 71gt lt 71gt ltgt 72gt lt 72gt 71gt x thu 051 aHxZ thu 051 a1xl Dtlua0x1 0411 bmuW bm71um71gt qu bou n xn Dtnu an71ua1u a1xZ thuotluao xl 0411 7 m mil ibmu bm71u b1ubou Method B 3 Now choose 04 s to eliminate uderivatives LL12 u cf alu an1x1 1 a1u 1 a1 05111 a0 x1 a1u m mil bmu bmilu blu bou rt 56 anle L1le aux1 a1u a2 an71a1u 1 an aHUtn1 a1a111 1 a anan72anil a0alu bmum bmilum b1ub0u Method B 4 a1 2 bn 052 7171051 bnil an anilanil 11051 b1 solve recursively for 0539s then xn anilxn alx2 an1 bou Method B 5 x1 x2 a2u XHZXn 0 yx1a1u 55quot aHXn a1x2 a0x1b0u 0 1 0 0 a2 0 39 f A 39 0 b 0 0 0 1 0quot a0 aH aH b C 1 0 0 D 051 Example 4s25 G s s33s22 ji3y2y4ii5u x1 y alu x2 x1 a2u x3 x2 a3u x3 0531 a2ii 051u393x3 a3u a2u a1u2xl a1u 4ii5u terms all 0 ii terms a2 4 uterms a33a203a3 12 x3 3x3 12u2x1 514 Example Cont d x1 x2 4L x2 x3 12u x3 2 2x1 3x3 41u yx1 010 A001b 20 3 cl 0 0 d0 Example MATLAB a x1 x2 x3 gtgtstf39s39 10 gtgt G45A25 5A335A22 gtgt 55G x1 x2 x3 C OONH x1 3 0 x3 0625 Diagonal Form Consider the transfer function V n71 GSbns bHs blsb0 s a s 1 115 a0 Assume distinct poles 21 Aquot and write partial fraction expandion Cl CH Gsco S n Cl CH YscoUsS lUs S v Us De neXlsXns 1 msSAUltsgtXnltsgtmUltsgt Then YSCOUSC 1X1Squot39C X2 s Diagonal Form 2 From the definitions ofX1X2 561 4m u yclx1 cnxn 0014 xnz lx u n A O 1 0 2 quot 1 A b 39 O O 13 1 cc1 c2 0quot dc0 Example 432 5 GltSgt7 s33sz2 c 1 Cl 1 cl 1 c3 0 S319582 570097911770785003139 57009791170785003i co 0 01399943 c2 000028498 7 0497715 03 c 000028498 0497715 My Transfer function to state space 0 Companion form 2 versions I Both give real coefficients I No need to factor numerator or denominator Diagonal form I Coefficients can be complex I Need to factor denominator Mem 255 Lecture 2b Review of Laplace Transform Laplace transform 1 Lft I e ftdt Where 0 fa piecewise continuous Examples Ex unit step function f t ux t Ex2 unit step function f t 5t tlt0 t20 2 Ex3 unit step function f t e m tux t Laplace transform pairs 5t H 1 ux t H 1 s tux t H 1 s2 tquot uxt H nsquot1 e m ux t H 1s a sin wt uxt H ws2 02 cos 0t uxt H ss2 02 a e m sin at u t H J s a2 02 e701 cos 0t uxt H s a sa2 02 3 4 Laplace transform theorems Mathematical Model of a Mechanical System X 1 Linearity I a A La1f1t mm alLMlttgt1 azLUzm 2 Frequency shift I 13 fat o o ft HFs 3 e mft H Fsa z 3 Time shift f t gt Fs Freebody diagram 3 ft Tust T lt gt e JTFs 5 Scaling ftHFs 3 fat H lFsa a UI Differentiation ft lt gtFs Ex 1 M1B3K2 3 L215 H sFs f0 x00X00ft st dzfo Find xt alt2 dquotft dtquot H s2 Fs sf0 f0 lt gt squotFs is f 0 k1 Integration ft HFs 2 It f7d7 lt gt 0 s gt Finalvalue theorem ft H Fs 3 ltimft ling sFs 9 Initialvalue theorem ft H Fs 3 lirgi ft lim sFs tgt yaw Ex2 M1B0K4 x005 00gtftuxt Find xt Ex3 M1B2K5 x00 jc00 ft10uxt Find xt
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'