Positive definite solution
Mostrar comentarios más antiguos
i need to solved for different values of gama until its lowest value, which gives a positive definite solution for P is found, so i am using all(eig(P)>0) like the equation below:
is this right?
gama=100000;
for i=1:2000;
P = inv(inv(P)+M'*inv(R)*M-gama^(-2)*eye(4));
E=eig(P_cov);
if all(eig(P))>0) %%(all eigenvalues must be positive)
gama=gama/2;
else
break;
end
end
P = inv(inv(P)+M'*inv(R)*M-gama^(-2)*eye(4));
is this correct?
Respuesta aceptada
Más respuestas (1)
Sean de Wolski
el 23 de Nov. de 2011
1 voto
Use a second variable and only update it if the eigenvalues are all positive. When you exit the loop it will be the last set of all positive eigenvalues.
1 comentario
dab483
el 23 de Nov. de 2011
Categorías
Más información sobre Linear Algebra en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!