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

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

Added original make3d

File size: 1.1 KB
Line 
1clc
2echo on
3yalmip('clear')
4%*********************************************************
5%
6% Modeling and solving KYP problems
7%
8%*********************************************************
9%
10% This example requires the KYPD-solver.
11%
12% We will show how we can use the dedicated
13% KYPD solver to solve a L2-gain analysis problem.
14%
15% minimize t
16%  s.t [A'P+PA+C'C PB;B'P -t] < 0
17%                           P > 0
18%
19pause
20
21% Define a random stable system
22n = 30;
23A = randn(n);A = A - max(real(eig(A)))*eye(n)*1.5;
24B = randn(n,1);
25C = randn(1,n);
26pause
27
28% YALMIP variables
29t = sdpvar(1,1);
30P = sdpvar(n,n);
31pause
32
33% KYP constraint
34% NOTE : Do not add the constraint P>0
35% if you want to use the KYPD solver)
36F = set(kyp(A,B,P,blkdiag(C'*C,-t)) < 0)
37pause
38
39% Solve using dedicated solver
40sol1 = solvesdp(F,t,sdpsettings('solver','kypd'));
41pause
42
43% Solve using SeDuMi (or any other standard SDP solver)
44sol2 = solvesdp(F,t,sdpsettings('solver','sedumi'));
45pause
46
47% Compare solution time (this can be a bit mis-leadinhg due to memory caching etc...)
48% KYPD should typically be a lot faster than the straight-forward solution
49sol1.solvertime/sol2.solvertime
50
51pause
52echo off
Note: See TracBrowser for help on using the repository browser.