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

1 visualización (últimos 30 días)
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.

Respuestas (1)

Star Strider
Star Strider el 27 de Feb. de 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.

Categorías

Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by