code assistance
Mostrar comentarios más antiguos
Hi,
I wrote the following code to solve an equation ,to find lambda that nulls the equation (Setting the equation to zero).But when i run the code,Lambda=[],i don't why.the code is:
%%%%%%%%FIND LAMBDA AND EIGEN VALUE
load saved_data;
theta=pi/2;
zeta=cos(theta);
I=eye(n,n);
Q=zeta*I-p*p';
%T is a matrix(5,5)
T=M.^(1/2)*Q*M.^(1/2);
format short e;
%find the eigen values
E=eig(T);
%find the negative eigen values
ind=find(E<0);
G=E(ind);
%find the smallest negative eigen value
gamma=min(abs(G));
%find lambda which is in the interval[0,-1/gamma]
for lambda=0:-1/gamma;
Q=zeta*I-p*p';
W=inv(M)+lambda.*Q;
finsym(-zm'*inv(M)*inv(W)*Q*inv(W)*inv(M)*zm);
%The equation which will be solved to find the value of lambda
%which null the equation (Setting the equation to zero
solve(-zm'*inv(M)*inv(W)*Q*inv(W)*inv(M)*zm);
end
5 comentarios
Naz
el 26 de Nov. de 2011
Use {code} button to properly post the script
zayed
el 26 de Nov. de 2011
Naz
el 26 de Nov. de 2011
Check this out in help file: [V,D] = eig(A)
Walter Roberson
el 26 de Nov. de 2011
When you are in the editor, there is a block of 7 buttons at the top immediately under "* Body" and immediately over the box in which you can enter code. The right-most of those buttons is labeled "{} Code". For a demonstration of how to use that button effectively, please see http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099
zayed
el 26 de Nov. de 2011
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices 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!