Effacer les filtres
Effacer les filtres

How to solve a system of non linear equations with non-constant parameters?

1 vue (au cours des 30 derniers jours)
saar
saar le 27 Fév 2014
I have a system of 2 non_linear (quadratic) equations:
x^2 - 2*a*x + a^2 + y^2 - 2*b*y + b^2 = r^2
x^2 - 2*c*x + c^2 + y^2 - 2*d*y + d^2 = r^2
where x,y are unknowns , and a,b,c,d,r are parameters that change in every iteration inside a loop.
I've tried to use the 'solve()' method , but I get an answer that is a function of the parameters and I need the real number solution.

Réponses (1)

Star Strider
Star Strider le 27 Fév 2014
Use matlabFunction to create executable expressions:
syms a b c d r x y
[x, y] = solve(x^2 - 2*a*x + a^2 + y^2 - 2*b*y + b^2 == r^2, x^2 - 2*c*x + c^2 + y^2 - 2*d*y + d^2 == r^2);
x = simplify(collect(x));
y = simplify(collect(y));
xmf = matlabFunction(x)
ymf = matlabFunction(y)
Then use xmf and ymf (rename them if you want) in your loop.

Catégories

En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by