필터 지우기
필터 지우기

How should I store the value of f(x) in the output of fsolve?

조회 수: 1 (최근 30일)
Dan Zhu
Dan Zhu 2020년 6월 28일
댓글: Dan Zhu 2020년 10월 9일
I saw the example in the fsolve page:
F = @(x) [2*x(1) - x(2) - exp(-x(1));
-x(1) + 2*x(2) - exp(-x(2))];
x0 = [-5;-5];
options = optimoptions('fsolve','Display','iter');
[x,fval] = fsolve(F,x0,options)
which gives the result:
Norm of First-order Trust-region
Iteration Func-count f(x) step optimality radius
0 3 47071.2 2.29e+04 1
1 6 12003.4 1 5.75e+03 1
2 9 3147.02 1 1.47e+03 1
3 12 854.452 1 388 1
4 15 239.527 1 107 1
5 18 67.0412 1 30.8 1
6 21 16.7042 1 9.05 1
7 24 2.42788 1 2.26 1
8 27 0.032658 0.759511 0.206 2.5
9 30 7.03149e-06 0.111927 0.00294 2.5
10 33 3.29525e-13 0.00169132 6.36e-07 2.5
Now, I want to store the last value of f(x), 3.29525e-13, in a file, what should I do?

채택된 답변

Matt J
Matt J 2020년 6월 28일
>> norm(fval).^2
ans =
3.2953e-13

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Direct Search에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by