필터 지우기
필터 지우기

Syntax x = fmin('fun',x1,x2)

조회 수: 25 (최근 30일)
work wolf
work wolf 2016년 8월 31일
댓글: Star Strider 2016년 9월 1일
Syntax
x = fmin('fun',x1,x2)
x = fmin('fun',x1,x2,options)
x = fmin('fun',x1,x2,options,P1,P2, ...)
[x,options] = fmin(...)
are not working by matlab? the message from matlab as follows as:
>> f =@(x) x.^3-2*x-5;
>> x = fmin('f', 0, 2)
Undefined function 'fmin' for input arguments of type 'char'.
Did you mean:
>> x = min('f', 0, 2)
Error using min
MIN with two matrices to compare and a working dimension is not supported.
>> x = fminbnd('f', 0, 2)
Cannot find an exact (case-sensitive) match for 'f'

채택된 답변

Star Strider
Star Strider 2016년 8월 31일
You’re almost there.
This works:
f =@(x) x.^3-2*x-5;
x = fminbnd(f, 0, 2)
x =
816.4968e-003
  댓글 수: 18
work wolf
work wolf 2016년 9월 1일
Relly , thank you sooooo much
Star Strider
Star Strider 2016년 9월 1일
As always, my pleasure!

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2016년 8월 31일
"Note: The fmin function was replaced by fminbnd in Release 11 (MATLAB 5.3). In Release 12 (MATLAB 6.0), fmin displays a warning message and calls fminbnd."
If you are using MATLAB 5.3 or earlier, that is important information for us to know. If you are using something that old, you would use
x = fmin('f', 0, 2)
but you would also have to have created file f.m with content
function y = f(x)
y = x.^3-2*x-5;
  댓글 수: 2
work wolf
work wolf 2016년 8월 31일
x = fmins('fun',x0)
x = fmins('fun',x0,options)
x = fmins('fun',x0,options,[],P1,P2, ...)
[x,options] = fmins(...)
and
z = fzero('fun',x) z = fzero('fun',x,tol)
z = fzero('fun',x,tol,trace)
z = fzero('fun',x,tol,trace,P1,P2,...)
thankx, if the fmin function was replaced by fminbnd, what were replaced fmins and fzero?
Steven Lord
Steven Lord 2016년 8월 31일
fmins -> fminsearch
fzero -> fzero

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

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by