fsolve stopped because it exceeded the function evaluation limit, options.Ma​xFunctionE​valuations = 400 (the default value).

So I am trying to solve system of equations using fsolve but the message above keeps showing, here is my code
clc; clear; close all;
global X L2 t2 t1 h
L2= 4.42;
X= 4; t2= 100*pi/180; t1=50*pi/180; h=0.5; %initial values%
x= fsolve(@SiccorLift,[X;t2;t1;h]);
X= x(1); t2= x(2)*180/pi; t1= x(3)*180/pi; h= x(4);
function F= SiccorLift(x)
global L2
F(1) = x(1) + L2*cos(x(2)) - 5*cos(x(3));
F(2) = L2*sin(x(2))- 5*sin(x(3));
F(3)= x(1)+ 8*cos(x(3));
F(4)= 8*sin(x(3)) - x(4);
end

 채택된 답변

댓글 수: 2

thanks for your concern, I will remove global but this is my 1st time using matlab, so... any tips wtih the options?
format long g
L2= 4.42;
X = 4+1i; t2 = 100*pi/180 + 1i; t1 = 50*pi/180 + 1i; h=0.5; %initial values%
options = optimoptions(@fsolve, 'MaxFunctionEvaluations', 10000, 'MaxIterations', 10000);
x= fsolve(@(x)SiccorLift(x,L2), [X;t2;t1;h], options);
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
X= x(1); t2= x(2)*180/pi; t1= x(3)*180/pi; h= x(4);
disp(X)
2.96133921023046e-11 + 1.55828966080547i
disp(t2)
90.0000000007112 + 31.2519208822566i
disp(t1)
90.0000000002143 + 11.0910318354747i
disp(h)
8.15035377555743 - 1.20326062635646e-12i
function F= SiccorLift(x, L2)
F(1) = x(1) + L2*cos(x(2)) - 5*cos(x(3));
F(2) = L2*sin(x(2))- 5*sin(x(3));
F(3)= x(1)+ 8*cos(x(3));
F(4)= 8*sin(x(3)) - x(4);
end
You can get exact solutions; MATLAB thinks there are four of them, whereas Maple says there are two solutions.
... Yes, this does mean that the complex results are not accidents: the exact solutions are complex-valued.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2020년 12월 31일

댓글:

2020년 12월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by