Develop a Matlab code to find maximum and minimum eigenvalue

Develop a Matlab code to find maximum and minimum eigenvalues and eigenvectors for the following matrix using power method Av = lambda v, where v is the eigenvector and lambda is the eigenvalue A = [2 8 10 8 4 5 10 5 7] The iteration should stop when epsilon_a is less than 0.1% for an eigenvalue. You can use Matlab build-in function \"inv\" to find the inverse of A

Solution

Please find below the matlab code to calculate max and mini eigenvalues and eigenvectors:

eigenvector.m

>> format long
>> M = [2 8 10; 8 4 5; 10 5 7];
>> v = rand( 3, 1 );
>> prvsnorm = Inf; % This is to set the previous norm to infinity
>> for i=1:100
v = M * v / norm(v);
newnorm = norm(v);

if ( abs( newnorm prvsnorm ) < 1e-10 )
break;
elseif ( i == 100 )
error( \'method failed to converge\' );
else
prvsnorm = newnorm;
end
end
>> newnorm
newnorm = 12.5899223267361
>> i % This will check the number of iterations
i = 51

 Develop a Matlab code to find maximum and minimum eigenvalues and eigenvectors for the following matrix using power method Av = lambda v, where v is the eigenv

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site