0

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

user3303896
  • 57
  • 1
  • 2
  • 6

1 Answers1

4

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

syms x;
A=[2-x, 5; 2, 3-x];
solve(det(A) == 0)
sebas
  • 869
  • 7
  • 16
  • Hii,, yeah I know there is Det function.. But Im not alowed to use it!!! I have to calculate determinant manually with (2-x * 3-x)-(5*2)=0.. But I always get error in Matlab because the X variable never defined before...After I calculate manually then I will use matlab root function.. Do u know how to multipley (2-5) with (3-x)??? – user3303896 Feb 16 '14 at 18:14
  • define the variable as symbolic. `syms x; detA = (2-x)*(3-x)-5*2; solve(detA == 0);` Don't forget the parentheis or the expression will be wrong as in your question. – sebas Feb 16 '14 at 18:19