error using eig, input matrix contains nan or inf

1 vue (au cours des 30 derniers jours)
Harleen Kaur
Harleen Kaur le 6 Mai 2019
Commenté : Harleen Kaur le 6 Mai 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 commentaires
Walter Roberson
Walter Roberson le 6 Mai 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 le 6 Mai 2019
Yes, got it. Thank you.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by