Demo entry 6661183

Opt_tasl

   

Submitted by VORTEX on Nov 20, 2017 at 13:30
Language: Matlab. Code size: 413 Bytes.

%Exercise 5.6
x=[10,0]';%变动点
g=[1,1]';
a=0;
G=[10,-9;
    -9,10;];
count=0;
fun_1=0;
fun_2=0;
result=0;
while(sqrt(g'*g)>1e-6)
   g=[10*x(1)-9*x(2)+4,10*x(2)-9*x(1)-15]';
   a=(g'*g)/(g'*G*g);
   fun_1=5*x(1)^2-9*x(1)*x(2)+5*x(2)^2+4*x(1)-15*x(2)+13;
   x=x-a*g;
   fun_2=5*x(1)^2-9*x(1)*x(2)+5*x(2)^2+4*x(1)-15*x(2)+13;
   result=(fun_2+22)/(fun_1+22);
   disp(result);
   count=count+1;
end

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).