Error trying to solve an equation
Show older comments
I'm trying to write a script to find a decision boundary between two classes which are distributed as 2-dimensional normal distributions. Here is my script (the estimated mean and covariance matrices are calculated previous to this running):
e = exp(1);
syms x;
sig1_det = det(sigma1_est);
sig2_det = det(sigma2_est);
zero = solve(1/(sig1_det^(1/2))*exp(-1/2*(x-mu1_est)\sigma1_est...
*(x-mu1_est)') == 1/(sig2_det^(1/2))*exp(-1/2*(x-mu2_est)\...
sigma2_est*(x-mu2_est)'), x);
However, when I run this, I get an error on the line with the "solve" call. Here's the error(s):
Error using mupadmex Error in MuPAD command: Operands are invalid. [linalg::matlinsolve]
Error in sym/privBinaryOp (line 835) Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in \ (line 284) X = privBinaryOp(A, B, 'symobj::mldivide');
Error in script (line 6) zero = solve(1/(sig1_det^(1/2))*exp(-1/2*(x-mu1_est)\sigma1_est...
What'd I do wrong?
Answers (1)
Roger Stafford
on 24 Mar 2015
Edited: Roger Stafford
on 24 Mar 2015
0 votes
I see a couple of dubious entities in your expression to be solved. First, you have used the backslash symbol, '\', which doesn't seem to belong there, and second, you have used a quote sign: (x-mu1_est)') in two places, and that is inappropriate, too.
Categories
Find more on Code Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!