% power method 27th November-Tuesday
A=[5,2;2,8];
x=[1;0];
while(1)
temp=A*x
largest=max(temp)
f=temp/largest
yesno=isequal(x,f);
if yesno==0
x=f
end
if yesno ~=0
largest ;
break;
end
end
y=[1;0];
while(1)
I=eye(size(A));
d=largest*I;
B=A-d;
fin=B*y;
largb=max(abs(fin));
lar2=max(fin);
if largb~=lar2
largb=largb*-1;
end
div=fin/largb;
yes=isequal(y,div);
if yes==0
y=div
end
if yes ~=0
largb;
break;
end
end
f
div
final=largest+largb
No comments:
Post a Comment