Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Choose two real eigenvalues 1, 2 such that li/A2/> 10. Create a 2x2 symmetric ma

ID: 3111894 • Letter: C

Question

Choose two real eigenvalues 1, 2 such that li/A2/> 10. Create a 2x2 symmetric matrix A that has , 2 as its eigenvalues. Compute the corresponding eigenvectors ul and u2. Choose a vector #0 which is not parallel to any eigenvector of A, and such that u11. Submit all computations. Write a code that implements the power method. Run it on your matrix A, using zo as the initial guess, and report the approximate dominant eigenvalues for k = 21, 1 = 1,.. . , 10 and the error of approximation in a table. Choose two real eigenvalues 1, 2 such that |/ = 1.01. Repeat your work. Write a short analysis of both tables.

Explanation / Answer

clc;
clear all;

disp ( ' Enter the matrix whose eigen value is to be found')

% Calling matrix A

A = input ( ' Enter matrix A :   ')
% check for matrix A

% it should be a square matrix

[na , ma ] = size (A);
if na ~= ma
    disp('ERROR:Matrix A should be a square matrix')
    return
end

% initial guess for X..?

% default guess is [ 1 1 .... 1]'

disp('Suppose X is an eigen vector corresponding to largest eigen value of matrix A')
r = input ( 'Any guess for initial value of X? (y/n):   ','s');
switch r
    case 'y'
        % asking for initial guess
    X0 = input('Please enter initial guess for X : ')
        % check for initial guess
    [nx, mx] = size(X0);
    if nx ~= na || mx ~= 1
        disp( 'ERROR: please check your input')
        return
    end
    otherwise
    X0 = ones(na,1);
end

%allowed error in final answer

t = input ( 'Enter the error allowed in final answer: ');
tol = t*ones(na,1);
% initialing k and X

k= 1;
X( : , 1 ) = X0;
%initial error assumption
err= 1000000000*rand(na,1);
% loop starts

while sum(abs(err) >= tol) ~= 0
    X( : ,k+ 1 ) = A*X( : ,k); %POWER METHOD formula
    % normalizing the obtained vector
    [ v i ] = max(abs(A*X( : ,k+ 1 )));
    E = X( : ,k+ 1 );
    e = E( i,1);
    X(:,k+1) = X(:,k+1)/e;
    err = X( :,k+1) - X( :, k);% finding error
    k = k + 1;
end

%display of final result

fprintf (' The largest eigen value obtained after %d itarations is %7.7f ', k, e)
disp('and the corresponding eigen vector is ')
X( : ,k)

Enter the matrix whose eigen value is to be found
Enter matrix A :
[2 1; 3 4]

A =

     2     1
     3     4

Suppose X is an eigen vector corresponding to largest eigen value of matrix A
Any guess for initial value of X? (y/n):   [1; 1]
Enter the error allowed in final answer: 1e-4
The largest eigen value obtained after 8 itarations is 5.0000853
and the corresponding eigen vector is

ans =

    0.3333
    1.0000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote