Re: Re: Lyapunov Equation
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg792] Re: [mg713] Re: Lyapunov Equation
- From: gdelfino at conicit.ve (Gustavo Delfino)
- Date: Wed, 19 Apr 1995 00:43:31 -0400
>From: ggb at bigdog.engr.arizona.edu (Gene Bergmeier) >Subject: Lyapunov Equation >Date: 11 Apr 1995 06:00:56 GMT >Pardon the silly question, but my roommate and I are just beginning to >use Mathematica. We are attempting to solve the Lyapunov equation (from >nonlinear controls). The equation is > PA+Trans(A)P=-Q where > Q=I > P is symmetric > and A is general. >We have tried the following procedure. Set Q equal to a 2D identity >matrix, P as a matrix of p11, p12 and p22 and A as a matrix of known >coefficients. Then we stated the Lyapunov eq and asked Mathematica to >solve it for p11, p12 and p22. >Any thoughts or suggestions? I made a set of functions for that. I use the equation a little different, I use R instead of P, and the negative sign in the other side: Q=-(Trans(A)R+RA) I give Q and A as arguments, and the programs returns me all the coefficients of the symmetric P. For example if Q={{2,0}, {0,2}} and A={{ 0, 1}, {-wn^2,-2 zeda wn}} to obtain P, I run my program: Qatra[{{2,0}, {0,2}},{{ 0, 1}, {-wn^2,-2 zeda wn}}] to obtain: 2 2 2 1 + wn + 4 zeda 1 + wn -2 {{r11 -> -----------------, r22 -> ----------, r12 -> wn }} 2 wn zeda 3 2 wn zeda Here is the program: Clear[r] VarMatrix[var_,n_]:= Module[{}, var=.; Table[ ToExpression[ StringJoin[ ToString[ var ], ToString[ Min[i,j] ], ToString[ Max[i,j] ] ] ], {i,1,n},{j,1,n} ] ] Example: VarMatrix[r,3] {{r11, r12, r13}, {r12, r22, r23}, {r13, r23, r33}} VarList[var_,n_]:= Module[{}, var=.; Union[ Flatten[ Table[ ToExpression[ StringJoin[ ToString[ var ], ToString[ Min[i,j] ], ToString[ Max[i,j] ] ] ], {i,1,n},{j,1,n} ] ] ] ] Example VarList[r,3] {r11, r12, r13, r22, r23, r33} Qatra[q_,a_]:=Module[{R,qq}, r=.; n=Length[q]; R=VarMatrix[r,n]; qq=-(Transpose[a].R+R.a); Simplify[ Solve[ Flatten[ Table[ q[[l,c]]==qq[[l,c]], {c,1,n},{l,1,c} ] ], VarList[r,n] ] ] ] |Gustavo Delfino |gdelfino at dino.conicit.ve| |Universidad Metropolitana| CompuServe: 73000,1127| |Ingenieria Mecanica | FAX:(582) 963-7726| |Caracas, Venezuela |________________________|