Using in-line function with fminbnd

조회 수: 8 (최근 30일)
Gavin Seddon
Gavin Seddon 2015년 9월 11일
답변: Gavin Seddon 2015년 9월 11일
hello
I have created a separate handler (minusF) to deal with function maximum (fminbnd -f). However this needs an in line function. I get errors when using this. Will someone please instruct me on in line creation?
Thanks.
  댓글 수: 1
Stephen23
Stephen23 2015년 9월 11일
Don't use inline functions, use a function handle instead. They are much better for defining functions, and have many advantages over inline functions (which are considered essentially obsolete).

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

채택된 답변

Walter Roberson
Walter Roberson 2015년 9월 11일
minusF = @(x) -f(x)
No inline function needed, only an anonymous function.

추가 답변 (1개)

Gavin Seddon
Gavin Seddon 2015년 9월 11일
Thanks Walter and Steven.

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by