www.pudn.com > work123.rar > min_F.asv


function y = min_F(x,s_k) 
%MIN_F Summary of this function goes here 
%  Detailed explanation goes here 
% 一维搜索,黄金分割法 
a=0; 
b=50; 
l=0.000001;%终止精度 
s_temp=s_k.'; 
x1=a+0.382*(b-a); 
x2=a+b-x1; 
while(abs(b-a)>l) 
    x_temp1=x+x1.*s_temp;%R 
    x_temp2=x+x2.*s_temp; 
    if(F(x_temp1)>F(x_temp2)) 
        a=x1; 
        if (abs(b-a)>l)   
            x1=x2;  x2=a+0.618*(b-a);   
        end     
    else 
        b=x2; 
        if (abs(b-a)>l)  
            x2=x1;  x1=a+0.382*(b-a);   
        end  
    end 
end 
y=(a+b)/2;