Error using fminbnd function

6 views (last 30 days)
HIMANSHU SHARMA
HIMANSHU SHARMA on 14 Oct 2018
Commented: Matt J on 15 Oct 2018
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?

Accepted Answer

Torsten
Torsten on 15 Oct 2018
Convert vDS_ via "matlabFunction" to a numerical function handle before calling "fminbnd".
  2 Comments
HIMANSHU SHARMA
HIMANSHU SHARMA on 15 Oct 2018
Its working, thanks sir,
Matt J
Matt J on 15 Oct 2018
@HIMANSHU,
You should Accept-click Torsten's answer, if it solved your difficulty.

Sign in to comment.

More Answers (0)

Categories

Find more on Optimization in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!