Can you help me to use function fsolve to calculate costs?
1 view (last 30 days)
Show older comments
I HAVE A 2X2 NON LINEAR SYSTEM AND I WANT TO CALCULATE THE ITERATIONS AND ESPECIALLY THE FUNCTION AND JACOBIAN COSTS . CAN YOU HELP ME ?
I HAVE THIS CODE AND I DONT KNOW WHAT TO DO NEXT
% Define the function handle for the system of equations
F = @(x) [ (x(1)-4)^2 + (x(2)-4)^2 - 5; x(1)^2 + x(2)^2 - 16 ];
% Set the initial guess
x0 = [1.8; 3.7];
% Set the options for the solver
options = optimoptions('fsolve','Display','iter');
% Call the solver
[x, fval] = fsolve(F, x0, options);
format longeng
disp('The solution of the system is');
disp( x )
0 Comments
Answers (1)
Walter Roberson
on 4 Apr 2023
[x, fval, exitflag, info] = fsolve(F, x0, options);
number_of_info.iterations
However, nothing is recorded about the "cost" of the function, or the "cost" of the Jacobian estimatation.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!