solve the question ( fsolve , vpasolve)
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
is there any other way to solve the equation below.
clear all;clc;
a=0.5;
x=linspace(-2*a,2*a,100);
eqn=@(x,y,a)(y.^2./(x.^2+y.^2)).*(1-2.*(1-(x./(2*a)).^2-(y./(2*a)).^2))-(y./a).^2;
for k = 1:numel(x)
options = optimoptions('fsolve','Display','iter');
yv(k,:) = fsolve(@(y)eqn(x(k),y,a), 1, options);
end
plot(x,yv)
when ı change initial value for iteration, answers and graph is changing.
3 comentarios
Torsten
el 23 de Mayo de 2021
Editada: Torsten
el 23 de Mayo de 2021
If you multiply your equation by x^2+y^2, you see that you try to solve a quadratic equation in y^2. This equation might have 0, 1, 2 or 4 real solutions. Use symbolic computation using "solve" instead of "fsolve" to sort out the solution that makes sense for your problem.
Respuestas (1)
John D'Errico
el 22 de Mayo de 2021
I think you do not understand optimization. When you change the initial value, it is EXPECTED that the solver MAY converge to a different solution.
2 comentarios
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!