matlab中求函数的最小值
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/05 19:29:30
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)
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)
%这样写
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)
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)