作业帮 > 综合 > 作业

matlab中求函数的最小值

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/05/16 10:35:13
matlab中求函数的最小值
m=60;
m1=input('please input m1=');
a=m1/m
o1=0.09
o2=0.03
T=sym('(1-t-o1)*(1-log(t/(t+o2))/log(a))');
t2=1-o1
t1=a-o1
[tm,TM]=fminbnd(T,t1,t2)
报错是
? Error using ==> fcnchk
If FUN is a MATLAB object, it must have an feval method.
Error in ==> fminbnd at 148
funfcn = fcnchk(funfcn,length(varargin));
Error in ==> jm at 46
[tm,TM]=fminbnd(T,t1,t2)
matlab中求函数的最小值
%这样写
m=60;
m1=input('please input m1=');
a=m1/m
o1=0.09
o2=0.03
T=@(t) (1-t-o1).*(1-log(t./(t+o2))./log(a)); %inline函数要这样写!
t2=1-o1
t1=a-o1
[tm,TM]=fminbnd(T,t1,t2)