source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/demos/dualex.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 846 bytes
Line 
1yalmip('clear');
2clc
3echo on
4%*********************************************************
5%
6% Dual variables
7%
8%*********************************************************
9%
10% Dual variables can easily be extracted from the
11% optimal solution using YALMIP
12%
13pause
14
15% Let us solve a Lyapuov stability problem
16A = [-1 2;0 -2];
17P = sdpvar(2,2);
18F = set(P>eye(2),'Normalize P') + set(A'*P+P*A<0,'Lyapunov stability');
19pause % Strike any key to continue.
20
21% Find minimum trace solution
22solution = solvesdp(F,trace(P));
23pause % Strike any key to continue.
24clc
25
26% The dual solutions are readily obtained using simple indexing
27dual(F(1))
28dual(F(2))
29pause
30clc
31
32% ... or with the tags
33dual(F('Normalize P'))
34dual(F('Lyapunov stability'))
35pause
36clc
37
38% Complementary slackness ...
39trace(double(F(1))*dual(F(1)))
40trace(double(F(2))*dual(F(2)))
41pause
42echo off
Note: See TracBrowser for help on using the repository browser.