Borrar filtros
Borrar filtros

Can one use fsolve with symbolic value equations?

7 visualizaciones (últimos 30 días)
bh1910
bh1910 el 25 de Jul. de 2015
Editada: Walter Roberson el 18 de Nov. de 2016
Hello everyone. I am wondering if in Matlab, one can use symbolic variables together with fsolve. I have to equate a gradient (calculated from substituted variables) to zero. Here is what I tried. Could anyone tell me what is wrong with this? If I can't use fsolve with symbolic value equations, how could I solve for 2 nonlinear symbolic valued equations with two unknowns? Tks:
function gradB = myfun(X)
syms X(1) X(2) n m
B = subs(X(1)+ X(2), [X(1), X(2)], [n+m, n-m]);
gradB = gradient(B, [n, m])
Script
X0 = [...];
fhandle = @myfun;
X = fsolve(fhandle, X0)

Respuesta aceptada

Star Strider
Star Strider el 25 de Jul. de 2015
Editada: Star Strider el 25 de Jul. de 2015
It’s a bit difficult to follow what you’re doing, but if you want to use symbolic expressions and you don’t mind slow code, use the solve function.
the fsolve function will find the values where the argument function equates to zero, so if you want to do the same with your symbolic gradient, my answer to Finding the null gradient directly applies to your problem.
  6 comentarios
bh1910
bh1910 el 26 de Jul. de 2015
vpasolve did the job!
safi58
safi58 el 18 de Nov. de 2016
Hi Can you please post the code with vpasolve. thanks

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by