Hello, I need help completing this project, as I do not know how to initilize a
ID: 3778745 • Letter: H
Question
Hello,
I need help completing this project, as I do not know how to initilize a function, or use the prescribed functions to do as required. Your assistance would be appreciated.
rational basis (if it exists) for the corresponding eigenspace and the dimension of that eigenspace. Then, you will decide whether A is diagonalizable by applying the general theory If the matrix A is diagonalizable, the output has to contain an invertable matrix P and the diagonal matrix D, such that, A PDP or, equivalently, AP PD **Create a function in MATLAB function eigen(A) Your function eigen(A) will have a set of commands which will produce the following outputs for an nxn matrix A (each output has to be supplied with the corresponding message you could use the commands disp, or fprintf, or sprintf (1) A row vector L (use the command transpose) of all eigenvalues each eigenvalue repeats as many times as its multiplicity. You should also use closetozeroroundoff function (the code is below) to ensure that zero eigenvalues will be the 0. The basic MATLAB command for this part is eigCA) which returns a column vector of all eigenvalues of A. (2) A row vector M of all distinct eigenvalues (no repetition is allowed). The MATLAB command unique can be used here (see help unique) (3) The sum of the multiplicities, Q, of all eigenvalues (Q must to be equal to n) with the message: "The sum of multiplicities of the eigenvalues is QE" (output Q) (4) For each distinct eigenvalue, the output has to include a "rational" basis W for the corresponding eigenspace and its dimension. An appropriate command in MATLAB that creates a rational basis by using the row-operations is null( ,'r'). (Note: command nu creates an orthonormal basis for the null space use help null command in MATAB for more information). Within the code for this part, BONUS points can be earned (see (7) below)Explanation / Answer
function [D,P] = eigen(A)
[Q,D] = eig(A) %getting eigen vectors and values of A
D = inv(Q)*A*Q
P = Q*D*inv(Q)
res = closetozer0roundoff(A*P - P*D)
end
function B = closetozer0roundoff(A)
[m,n] = size(A)
for i=1:m
for j=1:n
if abs(A(i,j)) < 10^(-7)
A(i,j) = 0;
end
end
end
B=A
end
function J = jord(n,r)
A = ones(n);
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.