matlab .a .b file,MATLAB创建m文件后提示to run this file,you can either change the matlab current directory ...

b357216499010bdf2c78f9eb61d172be.pngMATLAB创建m文件后提示to run this file,you can either change the matlab current directory or add...function [s,phis,k,G,E]=golds(phi,a,b,delta,epsilon)%功能:0.618法精确线搜索%输入:phi是目标函数,a,b 是搜索区间的两个端点%

2017-01-26

MATLAB创建m文件后提示to run this file,you can either change the matlab current directory or add...

function [s,phis,k,G,E]=golds(phi,a,b,delta,epsilon)

%功能:0.618法精确线搜索

%输入:phi是目标函数,a,b 是搜索区间的两个端点

% delta,epsilon分别是自变量和函数值的容许误差

%输出:s,phis分别是近似极小点和极小值,G是nx4矩阵,

% 其第k行分别是a,p,q,b的第k次迭代值[ak,pk,qk,bk],

% E=[ds,dphi],分别是s和phis的误差限.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

t=(sqrt(5)-1)/2; h=b-a; phia=feval(phi,a); phib=feval(phi,b);

p=a+(1-t)*h; q=a+t*h; phip=feval(phi,p); phiq=feval(phi,q);

k=1; G(k,:)=[a,p,q,b];

while(abs(phib-phia)>epsilon)||(h>delta)

if(phip

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值