문제

Could someone help me solve this problem in Matlab.. Suppose I have this Matriks

 A=[2-x 5    
    2   3-x ]

where det(A)=0;

So, it can be written as : (to alculate the detrminant)

   (2-x * 3-x)-(5*2)=0

But In matlab I cannot put x before I define it..

There will be an error :

 Undefined function or variable 'x'.

Please help me!! I'm not allowed to use det function from Matlab!!!

도움이 되었습니까?

해결책

You have to say matlab that x is a symbolic variable:

syms x;
A=[2-x, 5; 2, 3-x];
solve(det(A) == 0)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top