# H2 norm numerical problem?

Hello,

I am trying to synthetize a discrete LQR controller solving the problem as linear programming with LMI constraints. After some problem I stepped back to the simpler H2 norm calculation problem first. The first part of the script below is just used to calculate the system matrices. The optimization is a very simple problem. It works fine for small value of parameters Q1 (and the result match with matlab functions norm), but when it reach a value around 1e15 the optimization problem become unfeasible. Since from a control engineering point of view such a value of Q1 makes totally sense, I suspect some numerical problem. Any suggestion?

Andrea

clear
close all

Ts = 1e-3;

% continuous plant
s = ss(zpk([],[-10 -20 -30 -40 -50],10 * 20 * 30 * 40 * 50));
Ac = s.A;
Bc = s.B;
C = s.C;

% discrete plant
[A,Bu] = c2d(Ac,Bc,Ts);

nx = size(A,2);
nu = size(Bu,2);

% LQR weights
Q1 = 1e15;
Q = diag([Q1 0 0 0 0]);
R = 1;
K = -dlqr(A,Bu,Q,R,[]);

Cz = [sqrt(Q);
zeros(nu,nx)];
Dzu = [zeros(nx,nu);
sqrt( R )];

Bw = eye(nx);
nw = nx;

% closed loop matrices
Acl = A+BuK;
Ccl = Cz+Dzu
K;

% cvx
cvx_begin sdp

``````variable P(nx,nx) symmetric

minimize trace(Ccl*P*Ccl');

Acl*P*Acl' - P + Bw*Bw' <= 0;

P >= 0;
``````

cvx_end

h2n = norm(ss(Acl,Bw,Ccl,[],Ts))^2
trace(CclPCcl’)

Double precision floating point solvers don’t deal well or reliably with huge numbers such as 1e15, so don’t use them. Change your scaling, or whatever, if you can.