solve the question ( fsolve , vpasolve)

조회 수: 4 (최근 30일)
onur karakurt
onur karakurt 2021년 5월 22일
편집: Torsten 2021년 5월 23일
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
Torsten
Torsten 2021년 5월 23일
편집: Torsten 2021년 5월 23일
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.
Torsten
Torsten 2021년 5월 23일
편집: Torsten 2021년 5월 23일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

John D'Errico
John D'Errico 2021년 5월 22일
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
onur karakurt
onur karakurt 2021년 5월 22일
solve function is not sufficient to answer the question, ı tried this fsolve function. How can I get correct y values.
onur karakurt
onur karakurt 2021년 5월 22일
what is the correct function to solve the equation

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by