Show all work
Project4.m is also in the picture
trix A---2 1 21 . Print out the M of the ma ut it ? nt out the Matlab outp Question 6: Run the provided program \"projec Find the d to obtain the randomly generated matrix [131 A0x10 and a randomly generated initial vector vector zo. Find the dominant eigenvalue and a corre- .m sponding eigenvector of A using the Power Me le when mari- rations m Is safer to p the eigenve ange between thently close, for example, when mar(abs(4m ze) CU001 if there when +change between the enhut it may- ag the Power Method Version 11. Decide when to stop your iteration +1 and zk entries). Note: The first few iterations may look like that are sufficiently cl form more iterations (210) to obtain the domian ector is con vergent but it may lead to a wrong eigenval o obtain the dominant eigenvalue and the corresponding ue. It is safer to per- eigenvector.
n=10;
rand(\'state\',sum(100*clock));
m=int8(n*rand(1));
rand(\'state\',sum(100*clock));
v=rand(n,1);
I=eye(n);
v=v+1.5*I(:,m)
D=diag(v);
while 0<1
rand(\'state\',sum(100*clock));
P=rand(n);
if (abs(det(P))>0.01) break;
end
end
A=P*D*inv(P)
rand(\'state\',sum(100*clock));
x0=rand(n,1)
%Solution for dominant eigen value
x=x0;
for i=1:15
c=transpose(x)*x;
D=(1/sqrt(c))*x;
x=A*D;
end
c=transpose(x)*x;
Dominant_eigenvalue=sqrt(c)
[V,D]=eig(A)
%The last column vector in V represents the eigen vector for dominant eigen value