Script proba_LTI_passivity
file: proba_LTI_passivity.m author: Peter Polcz <ppolcz@gmail.com>
Created on 2017.03.18. Saturday, 22:48:49
Contents
% Automatically generated stuff global SCOPE_DEPTH SCOPE_DEPTH = 0; TMP_QVgVGfoCXYiYXzPhvVPX = pcz_dispFunctionName; try c = evalin('caller','persist'); catch; c = []; end persist = pcz_persist(mfilename('fullpath'), c); clear c; persist.backup(); %clear persist
┌proba_LTI_passivity │ - Persistence for `proba_LTI_passivity` reused (inherited) [run ID: 3492, 2017.03.18. Saturday, 23:28:54] │ - Script `proba_LTI_passivity` backuped
LTI SISO Passivity
Ez a rendszer NEM passziv, mert relativ foka 2! Controller formbol adodoan: .
A = [
-2 -2 -1
1 0 0
0 1 0
];
B = [ 1 ; 0 ; 0 ];
C = [ 0 1 1 ];
P = sdpvar(3);
Constraints = [
P >= 0 , ...
[
A'*P + P*A , P*B - C'
B'*P - C , 0
] <= 0
];
optimize(Constraints)
MOSEK Version 7.1.0.51 (Build date: 2016-4-5 06:54:35) Copyright (c) 1998-2016 MOSEK ApS, Denmark. WWW: http://mosek.com Platform: Linux/64-X86 Computer Platform : Linux/64-X86 Problem Name : Objective sense : min Type : CONIC (conic optimization problem) Constraints : 6 Cones : 0 Scalar variables : 0 Matrix variables : 2 Integer variables : 0 Optimizer started. Conic interior-point optimizer started. Presolve started. Linear dependency checker started. Linear dependency checker terminated. Eliminator - tries : 0 time : 0.00 Eliminator - elim's : 0 Lin. dep. - tries : 1 time : 0.00 Lin. dep. - number : 0 Presolve terminated. Time: 0.00 Optimizer - threads : 4 Optimizer - solved problem : the primal Optimizer - Constraints : 6 Optimizer - Cones : 0 Optimizer - Scalar variables : 0 conic : 0 Optimizer - Semi-definite variables: 2 scalarized : 16 Factor - setup time : 0.00 dense det. time : 0.00 Factor - ML order time : 0.00 GP order time : 0.00 Factor - nonzeros before factor : 21 after factor : 21 Factor - dense dim. : 0 flops : 8.65e+02 ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME 0 5.0e+00 1.0e+00 1.0e+00 0.00e+00 0.000000000e+00 0.000000000e+00 1.0e+00 0.00 1 1.1e+00 2.1e-01 2.1e-01 -2.08e-01 -1.029830788e+00 0.000000000e+00 2.1e-01 0.01 2 3.1e-16 1.3e-01 8.4e-02 -5.42e-01 -1.029830788e+00 0.000000000e+00 8.6e-02 0.01 Interior-point optimizer terminated. Time: 0.01. MOSEK DUAL INFEASIBILITY REPORT. Problem status: The problem is dual infeasible Optimizer terminated. Time: 0.02 Interior-point solution summary Problem status : DUAL_INFEASIBLE Solution status : DUAL_INFEASIBLE_CER Primal. obj: -4.8168824580e-01 Viol. con: 3e-16 barvar: 0e+00 Optimizer summary Optimizer - time: 0.02 Interior-point - iterations : 2 time: 0.01 Basis identification - time: 0.00 Primal - iterations : 0 time: 0.00 Dual - iterations : 0 time: 0.00 Clean primal - iterations : 0 time: 0.00 Clean dual - iterations : 0 time: 0.00 Clean primal-dual - iterations : 0 time: 0.00 Simplex - time: 0.00 Primal simplex - iterations : 0 time: 0.00 Dual simplex - iterations : 0 time: 0.00 Primal-dual simplex - iterations : 0 time: 0.00 Mixed integer - relaxations: 0 time: 0.00 ans = yalmiptime: 0.1597 solvertime: 0.0365 info: 'Infeasible problem (MOSEK)' problem: 1
LTI SISO with observer
Azonban ha tervezek hozza egy allapotbecslot, akkor az egyuttes rendszer mar 1-es relativ foku lesz, vagyis passziv.
L = place(A',C',[-1 -0.5 -2])'; A_ = [ A , zeros(3,3) L*C , A - L*C ]; B_ = [ B ; B ]; C_ = [ zeros(1,3) ones(1,3) ]; C_*B_ P_ = sdpvar(6); Constraints = [ P_ >= 0 , ... [ A_'*P_ + P_*A_ , P_*B_ - C_' B_'*P_ - C_ , 0 ] <= 0 ]; optimize(Constraints) P_ = double(P_); x0 = [ rand(3,1) ; zeros(3,1) ]; sys = ss(A_,B_,C_,0); [u_num,t_num] = gensig('square',20,100,0.1); u = @(t) interp1(t_num, u_num, t); [t_ode,x_ode] = ode45(@(t,x) A_*x + B_*u(t), [0,100], x0); y_ode = x_ode * C_'; u_ode = u(t_ode); V = diag(x_ode * P_ * x_ode'); dV = diag(x_ode * (A_'*P_ + P_*A_) * x_ode') + ... diag(u_ode * (B_'*P_) * x_ode') + ... diag(x_ode * (P_*B_) * u_ode'); s = 2 * y_ode .* u_ode; figure('Position', [ 305 281 1553 633 ], 'Color', [1 1 1]), subplot(223) plot(t_ode,[u_ode,y_ode]), ptitle('Bemenet, kimenet az ido fuggvenyeben') plabel 'x' 'time $t$' plabel 'y' '$u(t), y(t)$' subplot(224) plot(t_ode,dV - s) title 'Passivity test (SISO): $\dot V(t) \le 2\cdot u(t) \cdot y(t) $' interpreter latex plabel 'x' 'time $t$' plabel 'y' '$\dot V(t) - 2\cdot u(t) \cdot y(t)$' subplot(211) plot(t_ode,x_ode) ptitle('Allapotvaltozok az ido fuggvenyeben') plabel 'x' 'time $t$' plabel 'y' '$x(t)$'
ans = 1 MOSEK Version 7.1.0.51 (Build date: 2016-4-5 06:54:35) Copyright (c) 1998-2016 MOSEK ApS, Denmark. WWW: http://mosek.com Platform: Linux/64-X86 Computer Platform : Linux/64-X86 Problem Name : Objective sense : min Type : CONIC (conic optimization problem) Constraints : 21 Cones : 0 Scalar variables : 0 Matrix variables : 2 Integer variables : 0 Optimizer started. Conic interior-point optimizer started. Presolve started. Linear dependency checker started. Linear dependency checker terminated. Eliminator - tries : 0 time : 0.00 Eliminator - elim's : 0 Lin. dep. - tries : 1 time : 0.00 Lin. dep. - number : 0 Presolve terminated. Time: 0.00 Optimizer - threads : 4 Optimizer - solved problem : the primal Optimizer - Constraints : 21 Optimizer - Cones : 0 Optimizer - Scalar variables : 0 conic : 0 Optimizer - Semi-definite variables: 2 scalarized : 49 Factor - setup time : 0.00 dense det. time : 0.00 Factor - ML order time : 0.00 GP order time : 0.00 Factor - nonzeros before factor : 231 after factor : 231 Factor - dense dim. : 0 flops : 1.45e+04 ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME 0 5.0e+00 1.0e+00 1.0e+00 0.00e+00 0.000000000e+00 0.000000000e+00 1.0e+00 0.00 1 8.7e-01 1.7e-01 1.7e-01 -2.53e-01 -7.632831160e-01 0.000000000e+00 1.7e-01 0.01 2 2.3e-01 4.6e-02 4.6e-02 6.63e-01 -7.486100366e-02 0.000000000e+00 4.6e-02 0.01 3 2.8e-02 5.6e-03 5.6e-03 1.37e+00 -4.542576317e-03 0.000000000e+00 5.6e-03 0.01 4 2.8e-03 5.6e-04 5.6e-04 1.05e+00 -4.114345352e-04 0.000000000e+00 5.6e-04 0.01 5 1.7e-04 3.3e-05 3.3e-05 1.01e+00 -2.479762506e-05 0.000000000e+00 3.3e-05 0.01 6 8.9e-06 1.8e-06 1.8e-06 9.98e-01 -1.384659975e-06 0.000000000e+00 1.8e-06 0.01 7 5.0e-07 1.0e-07 1.0e-07 9.95e-01 -8.541464338e-08 0.000000000e+00 1.0e-07 0.01 8 3.2e-08 6.4e-09 6.4e-09 9.87e-01 -6.511520713e-09 0.000000000e+00 6.4e-09 0.01 9 2.6e-09 5.3e-10 5.3e-10 9.72e-01 -6.848746048e-10 0.000000000e+00 5.3e-10 0.01 Interior-point optimizer terminated. Time: 0.01. Optimizer terminated. Time: 0.01 Interior-point solution summary Problem status : PRIMAL_AND_DUAL_FEASIBLE Solution status : OPTIMAL Primal. obj: -6.8487460477e-10 Viol. con: 5e-09 barvar: 0e+00 Dual. obj: 0.0000000000e+00 Viol. con: 0e+00 barvar: 9e-10 Optimizer summary Optimizer - time: 0.01 Interior-point - iterations : 9 time: 0.01 Basis identification - time: 0.00 Primal - iterations : 0 time: 0.00 Dual - iterations : 0 time: 0.00 Clean primal - iterations : 0 time: 0.00 Clean dual - iterations : 0 time: 0.00 Clean primal-dual - iterations : 0 time: 0.00 Simplex - time: 0.00 Primal simplex - iterations : 0 time: 0.00 Dual simplex - iterations : 0 time: 0.00 Primal-dual simplex - iterations : 0 time: 0.00 Mixed integer - relaxations: 0 time: 0.00 ans = yalmiptime: 0.1554 solvertime: 0.0248 info: 'Successfully solved (MOSEK)' problem: 0
End of the script.
pcz_dispFunctionEnd(TMP_QVgVGfoCXYiYXzPhvVPX);
clear TMP_QVgVGfoCXYiYXzPhvVPX
└ 1.308 [sec]