1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
2 | <html> |
---|
3 | |
---|
4 | <head> |
---|
5 | <meta http-equiv="Content-Language" content="en-us" /> |
---|
6 | <title>YALMIP Example : Lyapunov stability</title> |
---|
7 | <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> |
---|
8 | <meta content="Microsoft FrontPage 6.0" name="GENERATOR" /> |
---|
9 | <meta name="ProgId" content="FrontPage.Editor.Document" /> |
---|
10 | <link href="yalmip.css" type="text/css" rel="stylesheet" /> |
---|
11 | <base target="_self" /> |
---|
12 | </head> |
---|
13 | |
---|
14 | <body leftmargin="0" topmargin="0"> |
---|
15 | |
---|
16 | <div align="left"> |
---|
17 | <table border="0" cellpadding="4" cellspacing="3" style="border-collapse: collapse" bordercolor="#000000" width="100%" align="left" height="100%"> |
---|
18 | <tr> |
---|
19 | <td width="100%" align="left" height="100%" valign="top"> |
---|
20 | <h2>Lyapunov stability</h2> |
---|
21 | <hr noshade size="1" color="#000000" /> |
---|
22 | <p>Given a linear dynamic system <strong>x' = Ax</strong>, our goal is to |
---|
23 | prove stability by finding a symmetric matrix <b>P</b> satisfying </p> |
---|
24 | <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> |
---|
25 | <p><span style="font-style: normal"><strong> |
---|
26 | <img border="0" src="lyapun6.gif" /></strong></span></p> |
---|
27 | </blockquote> |
---|
28 | <p>Define a matrix <b><font face="Tahoma">A</font></b> and the symmetric matrix |
---|
29 | <b><font face="Tahoma">P</font></b>.</p> |
---|
30 | <table cellpadding="10" width="100%"> |
---|
31 | <tr> |
---|
32 | <td class="xmpcode"> |
---|
33 | <pre>A = [-1 2;-3 -4]; |
---|
34 | P = sdpvar(2,2);</pre> |
---|
35 | </td> |
---|
36 | </tr> |
---|
37 | </table> |
---|
38 | <p>Having <b>P</b>, we are ready to define the constraints.</p> |
---|
39 | <table cellpadding="10" width="100%"> |
---|
40 | <tr> |
---|
41 | <td class="xmpcode"> |
---|
42 | <pre>F = set(P > 0) + set(A'*P+P*A < 0);</pre> |
---|
43 | </td> |
---|
44 | </tr> |
---|
45 | </table> |
---|
46 | <p>To avoid the zero solution or an unbounded solution, we constrain the trace |
---|
47 | of the matrix (Of course, this is not the only way. We could have used, e.g., |
---|
48 | the constraint <b><font face="Tahoma">P>I</font></b> instead)</p> |
---|
49 | <table cellpadding="10" width="100%"> |
---|
50 | <tr> |
---|
51 | <td class="xmpcode"> |
---|
52 | <pre>F = F + set(trace(P) == 1);</pre> |
---|
53 | </td> |
---|
54 | </tr> |
---|
55 | </table> |
---|
56 | <p>At this point, we are ready to solve our problem. But first, we display |
---|
57 | the collection of constraints to see what we have defined.</p> |
---|
58 | <table cellpadding="10" width="100%"> |
---|
59 | <tr> |
---|
60 | <td class="xmpcode"> |
---|
61 | <pre>F |
---|
62 | <font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
63 | | ID| Constraint| Type| |
---|
64 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
65 | | #1| Numeric value| Matrix inequality 2x2| |
---|
66 | | #2| Numeric value| Matrix inequality 2x2| |
---|
67 | | #3| Numeric value| Equality constraint 1x1| |
---|
68 | +++++++++++++++++++++++++++++++++++++++++++++++++++</font></pre> |
---|
69 | </td> |
---|
70 | </tr> |
---|
71 | </table> |
---|
72 | <p>We only need a feasible solution, so one argument is sufficient when we |
---|
73 | call <a href="reference.htm#solvesdp">solvesdp</a> to solve the problem.</p> |
---|
74 | <table cellpadding="10" width="100%"> |
---|
75 | <tr> |
---|
76 | <td class="xmpcode"> |
---|
77 | <pre>solvesdp(F); |
---|
78 | P_feasible = double(P);</pre> |
---|
79 | </td> |
---|
80 | </tr> |
---|
81 | </table> |
---|
82 | <p>The resulting constraint satisfaction can be conveniently investigated |
---|
83 | with <a href="reference.htm#checkset">checkset</a>.</p> |
---|
84 | <table cellpadding="10" width="100%"> |
---|
85 | <tr> |
---|
86 | <td class="xmpcode"> |
---|
87 | <pre>checkset(F) |
---|
88 | <font color="#000000">+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
89 | | ID| Constraint| Type| Primal residual| Dual residual| Compl. slack| |
---|
90 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
91 | | #1| Numeric value| LMI| 0.32029| 2.7929e-014| 4.983e-014| |
---|
92 | | #2| Numeric value| LMI| 1.6706| 2.5781e-015| 1.936e-014| |
---|
93 | | #3| Numeric value| Equality constraint| -2.0151e-014| -1.0991e-014| 2.2148e-028| |
---|
94 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</font></pre> |
---|
95 | </td> |
---|
96 | </tr> |
---|
97 | </table> |
---|
98 | <p>Minimizing, e.g., the top-left element of <b> |
---|
99 | <font face="Tahoma,Arial,sans-serif">P</font></b> is done by specifying an |
---|
100 | objective function.</p> |
---|
101 | <table cellpadding="10" width="100%"> |
---|
102 | <tr> |
---|
103 | <td class="xmpcode"> |
---|
104 | <pre>F = set(P > 0) + set(A'*P+P*A < 0); |
---|
105 | solvesdp(F,P(1,1));</pre> |
---|
106 | </td> |
---|
107 | </tr> |
---|
108 | </table> |
---|
109 | </td> |
---|
110 | </tr> |
---|
111 | </table> |
---|
112 | </div> |
---|
113 | |
---|
114 | </body> |
---|
115 | |
---|
116 | </html> |
---|