在MATLAB命令中输入主函数Symstf=t^4-t^2-2*t+5;[x1,x2]=minJT(f,0,0.1)进退法确定搜索区间函数文件minJT如下:function[minx,maxx]=minJT(f,x0,h0,eps)%目标函数:f;%初始点:x0;%初始步长:h0;%精度:esp;%区间左端点:minx;%区间右端点:maxx;formatlong;ifnargin==3esp=1.0e-6;endx1=x0;k=0;h=h0;while1x4=x1+h;%试探歩k=k+1;f4=subs(f,findsym(f),x4);f1=subs(f,findsym(f),x1);iff4f1x2=x1;x1=x4;f2=f1;f1=f4;h=2*h;%加大步长elseifk==1h=-h;%反向搜索x2=x4;f2=f4;elsex3=x2;x2=x1;x1=x4;break;%终止循环进行endendendminx=min(x1,x3);maxx=x1+x3-minx;formatshort;