Error using fminbnd function

조회 수: 6 (최근 30일)
HIMANSHU SHARMA
HIMANSHU SHARMA 2018년 10월 14일
댓글: Matt J 2018년 10월 15일
i am trying to minimize function vDS_ using following commands
syms x
iC1_ = 1-3.58*sin(x+2.57)+0.86*cos(3*x)+1.227*sin(3*x)+2.17*sin(x+2.57) - 0.536;
f = int(iC1_,[0.75*pi x]);
VIN = int(f,[0.75*pi 2*pi]);
vDS_ = 2*pi*f/VIN;
fplot(vDS_,[0.75*pi,2*pi]);
[x,fval] = fminbnd(vDS_,0.75*pi,2*pi)
vDS_max = fval
But I am getting error as shown below
Error using fcnchk (line 106)
If FUN is a MATLAB object, it must have an feval method.
Error in fminbnd (line 191)
funfcn = fcnchk(funfcn,length(varargin));
Error in abc (line 7)
[x,fval] = fminbnd(vDS_,0.75*pi,2*pi)
Is there any problem with function definition?

채택된 답변

Torsten
Torsten 2018년 10월 15일
Convert vDS_ via "matlabFunction" to a numerical function handle before calling "fminbnd".
  댓글 수: 2
HIMANSHU SHARMA
HIMANSHU SHARMA 2018년 10월 15일
Its working, thanks sir,
Matt J
Matt J 2018년 10월 15일
@HIMANSHU,
You should Accept-click Torsten's answer, if it solved your difficulty.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by