MATLAB Answers

Positive definite solution

2 views (last 30 days)
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?
for i=1:2000;
P = inv(inv(P)+M'*inv(R)*M-gama^(-2)*eye(4));
if all(eig(P))>0) %%(all eigenvalues must be positive)
P = inv(inv(P)+M'*inv(R)*M-gama^(-2)*eye(4));
is this correct?

Accepted Answer

Walter Roberson
Walter Roberson on 23 Nov 2011
If the eigenvalues are all positive, you change gama, exiting the loop when they are not all positive. That means that at the end the gama you get out will be such that the eigenvalues are not all positive. This does not satisfy the stated conditions.
dab483 on 24 Nov 2011
Thank you. It satisfy the stated conditions.

Sign in to comment.

More Answers (1)

Sean de Wolski
Sean de Wolski on 23 Nov 2011
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 Comment
dab483 on 23 Nov 2011
Can you show it a litle bit.. i'm blank right now.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!