Question

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!!!

Était-ce utile?

La solution

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

syms x;
A=[2-x, 5; 2, 3-x];
solve(det(A) == 0)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top