code assistance
古いコメントを表示
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 件のコメント
Naz
2011 年 11 月 26 日
Use {code} button to properly post the script
zayed
2011 年 11 月 26 日
Naz
2011 年 11 月 26 日
Check this out in help file: [V,D] = eig(A)
Walter Roberson
2011 年 11 月 26 日
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
2011 年 11 月 26 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!