error using eig, input matrix contains nan or inf

1 visualización (últimos 30 días)
Harleen Kaur
Harleen Kaur el 6 de Mayo de 2019
Comentada: Harleen Kaur el 6 de Mayo de 2019
A=[-9.4375 0 0 0 6.9375;0 -162.5385 0 -1.218*10^(-5) 0;0 160.038 -2.5 -1.218*10^(-5) 0;2.5 -32007.7 0 -2.4975 0;6.9375 0 0 2.5 -9.4375];
C=[1 0 0 0 0;0 0 0 1 0;0 0 0 0 1;0 0 0 0 0;0 0 0 0 0];
% Continuous-time Model
nx=5; nc=5;
% Clear Old Variables
yalmip('clear'); C1=[]; C2=[];
% Define Variables
Z0=sdpvar(nx); Z1=sdpvar(nc,nx); % Z0 > 0
C1=[0 <= Z0];
% (Z0A-Z1C)'+(Z0A-Z1C) + I < 0
C2=[(Z0*A-Z1*C)+(Z0*A-Z1*C)' + eye(nx) <= 0];
% Define Constraints and Objective
Constraints=[C1,C2]; Objective=[];
% Determine Feasibility
options = sdpsettings('verbose',0,'solver','mosek'); sol = optimize(Constraints,Objective,options);
if sol.problem == 0 % problem is feasible
Z0feas=value(Z0); Z1feas=value(Z1); KKfeas=Z1feas/Z0feas
eig(A-C*KKfeas)
elseif sol.problem == 1 % problem is infeasible
disp('Infeasible Problem'); else
disp('Hmm, something went wrong!'); sol.info; pause
end
In this code I am getting an error, 'error using eig, matrix contains NaN or inf'.
My C matrix was 3*5, but I had to change to 5*5 as I should give same dimensions as of A. But because of 0's I am getting an error and can't take out eigen values.
Any help would be appreciated
  2 comentarios
Walter Roberson
Walter Roberson el 6 de Mayo de 2019
You do not appear to be pulling a value for Z0 out of sol, so I would suspect it might still be just the general variable you defined.
Note that yalmip is a third party package, and most of the volunteers will not be familiar with it.
Harleen Kaur
Harleen Kaur el 6 de Mayo de 2019
Yes, got it. Thank you.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by