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
Best Answer