MATLAB Answers

solve the question ( fsolve , vpasolve)

6 views (last 30 days)
onur karakurt
onur karakurt on 22 May 2021
Edited: Torsten on 23 May 2021
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 Comments
Torsten
Torsten on 23 May 2021
Solving your equation by hand gives y=0 as the only solution for all values of a and x different from 0. For x=0, no solution for y exists.

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 22 May 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 Comments
onur karakurt
onur karakurt on 22 May 2021
what is the correct function to solve the equation

Sign in to comment.

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by