source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/dev/regress_doubleintegrator.m @ 37

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

Added original make3d

File size: 1.2 KB
Line 
1yalmip('clear')
2clear all
3
4% Prediction horizon
5N = 5;
6
7double_integrator
8
9probStruct.N=N-1;
10probStruct.R = 100;
11probStruct.subopt_lev=0;
12probStruct.y0bounds=1;
13%probStruct.Tconstraint=0;
14probStruct.P_N = zeros(2);
15sysStruct.ymin = [-100;-100];
16sysStruct.ymax = [100;100];
17
18ctrl=mpt_control(sysStruct,probStruct);
19
20M=mpt_constructMatrices(sysStruct,probStruct)
21
22[H,K] = double(M.Pinvset);
23
24nx = 2;
25nu = 1;
26
27% States x(k), ..., x(k+N)
28x = sdpvar(repmat(nx,1,N),repmat(1,1,N));
29
30% Inputs u(k), ..., u(k+N) (last one not used)
31u = sdpvar(repmat(nu,1,N),repmat(1,1,N));
32
33% Value functions
34J = cell(1,N);
35
36% Initialize value function at stage N
37J{N} = 0;
38sysStruct.xmin = sysStruct.ymin;
39sysStruct.xmax = sysStruct.ymax;
40F = set([]);
41obj = 0;
42for k = N-1:-1:1
43    F = F + set(sysStruct.umin < u{k}     < sysStruct.umax);
44    F = F + set(sysStruct.ymin < sysStruct.C*x{k}   < sysStruct.ymax);
45    F = F + set(sysStruct.ymin < sysStruct.C*x{k+1} < sysStruct.ymax); 
46    F = F + set(x{k+1} == sysStruct.A*x{k}+sysStruct.B*u{k});   
47    obj = obj + norm([x{k};u{k}],1);%x{k}'*probStruct.Q*x{k}+u{k}*probStruct.R*u{k};   
48end
49
50[mpsol{k},sol{k},Uz{k},J{k}] = solvemp(F,obj,[],x{k},u{k});
51
52%[pass,tol] = mpt_isPWAbigger(mpsol{1}{1},ctrl)
Note: See TracBrowser for help on using the repository browser.