Error trying to solve an equation
Afficher commentaires plus anciens
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?
Réponses (1)
Roger Stafford
le 24 Mar 2015
Modifié(e) : Roger Stafford
le 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.
1 commentaire
Ben
le 24 Mar 2015
Catégories
En savoir plus sur Code Performance dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!