.、用黄金分割法求极值:;%建立原方程函数;function y=fx(x)if nargin=1 y=x+20/x;endend%a为区间下限,b为区间上限,e为精度;%fx(x)为原方程函数;function xj,yj=huangjin(a,b,e)a=input(Please enter the value of a:);b=input(Please enter the value of b:);e=input(Please enter the value of e:);while b-ae x1=a+0.382*(b-a); x2=a+0.618*(b-a); if fx(x1)fx(x2) b=x2; else a=x1; endend xj=(a+b)/2; yj=fx(xj);end此题中,a=0.2,b=1,e=0.01,程序运行结果为xj=0.9967,yj=21.