fminbnd supplies anonymous function with a vector rather than a scalar

2 views (last 30 days)
My M-file function Y = MEP_ObjFun(P,B,R,T) requires inputs scalar P and [1 x N] vectors B, R, T and returns a scalar Y.
When I call this anonymously using fminbnd()
Popt = fminbnd(@(y)MEP_ObjFun(y,B,R,T),lb,ub);
and inquire size(P) inside of MEP_ObjFun.m it returns [1 x N].
Why is fminbnd assuming I want to pass a vector rather than a scalar and how do I control this?
Thank you, Grey
  4 Comments
Laura Proctor
Laura Proctor on 22 Jun 2011
I just tried the same syntax for FMINBND as above and the value for P was always a scalar. Make sure that you are calling the correct function:
which -all fminbnd

Sign in to comment.

Accepted Answer

Grey Nearing
Grey Nearing on 22 Jun 2011
Problem: One (or both) of the bounds (lb, ub) is a vector.

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!