Multiple fminbnd errors with a parametrized function

2 views (last 30 days)
I am trying to use fminbnd for this function, where I was given parametrizations to plug in. It keeps giving me errors and I'm not sure what they mean. Any advice would be appreciated.
fun = exp(cos(t)) - sin((3^(1/2)*sin(t))/3);
t1 = 0;
t2 = 2*pi;
fminbnd(fun, t1, t2)
Error using fcnchk (line 107)
If FUN is a MATLAB object, it must have an feval method.
Error in fminbnd (line 198)
funfcn = fcnchk(funfcn,length(varargin));
Error in sevenbi (line 10)
fminbnd(fun, t1, t2)

Accepted Answer

Torsten on 25 Mar 2022
You are in the realm of numerical, not symbolic computations.
Here, functions are defined as handles:
fun = @(t) exp(cos(t)) - sin((3^(1/2)*sin(t))/3);
  1 Comment
Cassandra Meyer
Cassandra Meyer on 25 Mar 2022
Ohhh yup I was trying the @ symbol but forgot to define t. Thanks!!

Sign in to comment.

More Answers (1)

Catalytic on 25 Mar 2022
Here is a symbolic method, if that's what you wanted.
syms t f(t)
f(t) = exp(cos(t)) - sin((3^(1/2)*sin(t))/3);
ans = 




Community Treasure Hunt

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

Start Hunting!