预览加载中,请您耐心等待几秒...
1/8
2/8
3/8
4/8
5/8
6/8
7/8
8/8

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

命令格式为:[x,fval,exitflag,output]=fminunc(fun,x0,options);或[x,fval,exitflag,output]=fminsearch(fun,x0,options);[3]fminunc为中型优化算法的步长一维搜索提供了两种算法,由options中参数LineSearchType控制:LineSearchType=’quadcubic’(缺省值),混合的二次和三次多项式插值;LineSearchType=’cubicpoly’,三次多项式插值例1minf(x)=(4x12+2x22+4x1x2+2x2+1)*ex14用fminsearch函数求解4.用fminunc函数options11=optimset('HessUpdate','dfp')[x11,fval11,exitflag11,output11]=fminunc('fun2',[-1.22],options11)pauseoptions12=optimset('HessUpdate','dfp','LineSearchType','cubicpoly')[x12,fval12,exitflag12,output12]=fminunc('fun2',[-1.22],options12)pauseoptions21=optimset('HessUpdate','bfgs')[x21,fval21,exitflag21,output21]=fminunc('fun2',[-1.22],options21)pauseoptions22=optimset('HessUpdate','bfgs','LineSearchType','cubicpoly')[x22,fval22,exitflag22,output22]=fminunc('fun2',[-1.22],options22)pauseoptions31=optimset('HessUpdate','steepdesc')[x31,fval31,exitflag31,output31]=fminunc('fun2',[-1.22],options31)pauseoptions32=optimset(,'HessUpdate','steepdesc','MaxIter',8000,'MaxFunEvals',8000)[x32,fval32,exitflag32,output32]=fminunc('fun2',[-1.22],options32)pauseoptions33=optimset('HessUpdate','steepdesc','MaxIter',9000,'MaxFunEvals',9000)[x33,fval33,exitflag33,output33]=fminunc('fun2',[-1.22],options33)(ii)编写M文件zuisu.mx=[2;2];[f0,g]=detaf(x);whilenorm(g)>0.001d=-g'/norm(g);t=1.0;f=detaf(x+t*d);whilef>f0t=t/2;f=detaf(x+t*d);endx=x+t*d[f0,g]=detaf(x)end