Error using eig Input matrix contains NaN or Inf.

8 visualizaciones (últimos 30 días)
Kartik Loya
Kartik Loya el 13 de Abr. de 2020
Respondida: Christine Tobler el 14 de Abr. de 2020
%{
System with only kinematics and no dynamics
Differential drive mobile motor (KinematicDDMR)
no. of states = 6: [x, y, theta, cos(theta), sin(theta), time]
no. of inputs = 2: [Vr, Vl]
total states = 8
kinematics:-
1) X_dot = ((Vr+Vl)/2)*cos(theta)
2) y_dot = ((Vr+Vl)/2)*sin(theta)
3) theta_dot = (Vr-Vl)/L
4) cos(theta)_dot = -sin(theta)*(Vr-Vl)/L
5) sin(theta)_dot = cos(theta)*(Vr-Vl)/L
6) t_dot = 1
u_dot = u/eps +v/eps ; eps ===> 0
X_dot = [A G;0 1/eps]*Z_bar +B*v;
v* = (B'M'P'Z_bar)/eps
%}
% System Variable
syms x1 x2 x3 x4 x5 x6 x7 x8 c
x = [x1; x2; x3; x4; x5; x6; x7; x8];
nx = length(x);
nXu = 2; %inputs
Zbar = monomials(x,[0:1]);
nZ = length(Zbar);
nZs = nZ-nXu;
% Constants
a = 0.22; % max velocity (m/s)
epss = 1e-04;
eps = 0.1;
m = 1.5; % mass (Kg)
d = 100; % Delta (penalty on final destination)
L = 0.16; % length between wheels (m)
A = zeros(nx,nZs);
A(6,1)=1;
R=zeros(nZ,nZ); %(Z'*R*Z) = 1/2[(m*Vr^2)+(m*Vl^2)]
R(8,8)= m/2; R(9,9)= m/2;
G(1,1)=x4/2; G(1,2)=x4/2; G(2,1)=x5/2; G(2,2)=x5/2;
G(3,1)=1/L; G(3,2)=-1/L; G(4,1)=-x5/L; G(4,2)=x5/L;
G(5,1)=x4/L; G(5,2)=-x4/L; G(6,1)=0; G(6,2)=0;
G(7,1)=eps; G(8,2)=eps;
B = zeros(nx,nXu);
B(7,1)=eps; B(8,2)=eps;
Abar = [A G];
for i=1:nZ
for j = 1:nx
M(i,j) = diff(Zbar(i),x(j));
end
end
%initial conditions
x1=20; x2=30; x3=pi/3; x4=0; x5=0; x6=0; x7=0; x8=0;
Zi = subs(Zbar);
% final conditions
x1=0; x2=0; x3=0; x4=0; x5=0; x6=0; x7=0; x8=0;
Zf = subs(Zbar);
% reinstating the system variables
syms x1 x2 x3 x4 x5 x6 x7 x8 c
% sos program starts
prog = sosprogram(x);
% Bounding Inputs ( -0.22 < Vr, Vl < 0.22 )
prog = sosineq(prog,a^2-(x(7,1))^2);
prog = sosineq(prog,a^2-(x(8,1))^2);
% Decision variable
prog = sosdecvar(prog,c);
[prog,pbar] = sospolymatrixvar(prog,monomials(x,0),[nZ,nZ],'symmetric');
%pbar = p^-1;
% inequality equations
H = -M*Abar -transpose(M*Abar) + (1/eps)*M*B*transpose(M*B);
SC = [H pbar*(R^(1/2));(R^(1/2))*pbar eye(nZ,nZ)];
SC2 = [c [Zi;Zf]';[Zi;Zf] [pbar zeros(nZ,nZ);zeros(nZ,nZ) (1/(d-1)).*pbar]];
% Sos inequality constraints
prog = sosmatrixineq(prog,pbar-epss*eye(nZ,nZ),'quadraticMineq');
prog = sosmatrixineq(prog,H-epss*eye(nZ,nZ),'quadraticMineq');
prog = sosmatrixineq(prog,SC-epss*eye(nZ+nZ,nZ+nZ),'quadraticMineq');
prog = sosmatrixineq(prog,SC2-epss*eye(1+nZ+nZ,1+nZ+nZ),'quadraticMineq');
% sos objective
obj = c;
prog = sossetobj(prog,obj);
% sos solve
prog = sossolve(prog);
%get solution
c = sosgetsol(prog,c);
pbar = sosgetsol(prog,pbar);
p = pbar^(-1);
vstar = (transpose(transpose(Zbar)*p*M*B))/eps;
xdot = Abar*Zbar + B*vstar;
echo off;
Error using eig
Input matrix contains NaN or Inf.
Error in minpsdeig (line 73)
eigv(i) = min(eig(XX));
Error in maxstep (line 64)
mindxs = minpsdeig(reldx, K);
Error in wregion (line 99)
maxt1 = min(maxstep(dx,xc,uxc,K), maxstep(dz,zc,uzc,K));
Error in sedumi (line 467)
wregion(L,Lden,Lsd,...
Error in sossolve (line 149)
[x,y,info] = sedumi(At,b,c,K,pars);
Error in kinematicDDMR2 (line 97)
prog = sossolve(prog);

Respuestas (1)

Christine Tobler
Christine Tobler el 14 de Abr. de 2020
The function sossolve is part of a third-party tool, this seems to be their website: http://www.cds.caltech.edu/sostools/. It's probably best to contact them directly to get feedback on this.
The issue in EIG is that the input variable to it contains Inf or NaN values, meaning something has gone wrong in the computation before EIG was called. If you want to investigate yourself, you could step through using the debugger to try to find out when the Inf / NaN values first occur.

Categorías

Más información sobre Linear Algebra 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