MATLAB Problem: In linear algebra, if T is a square matrix and v is a column vec
ID: 3846919 • Letter: M
Question
MATLAB Problem:
In linear algebra, if T is a square matrix and v is a column vector, and the following conditions holds: Tv = lambda v, then v is an eigenvector of T, and scalar lambda is the corresponding eigenvalue. Write a function iseigen that will receive a 3 times 3 matrix T and a 3 times 1 vector v of real numbers. It will return a logical true if v is an eigen vector of T, otherwise it will return a logical false. If the function call expects two output arguments, the function will also return the corresponding eigenvalue provided that v is an eigen vector of T, otherwise it will return NaN as the second output.Explanation / Answer
function flag= iseigen(T,v)
res=1
lhs(0)= T(0,0) * v(0,0) + T(0,1)*v(1,0) + T(0,2)*v(2,0)
lhs(1)= T(1,0) * v(0,0) + T(1,1)*v(1,0) + T(1,2)*v(2,0)
lhs(2)= T(2,0) * v(0,0) + T(2,1)*v(1,0) + T(2,2)*v(2,0)
a= lhs(0)/v(0)
b= lhs(1)/v(1)
c= lhs(2)/v(2)
if(a==b&&b==c)
flag=true
else
flag=false
end
end
iseigen([1,2,3;4,5,6;7,8,9],[1,2,3])
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.