玫瑰函数图像 matlab用最速下降法(梯度法)计算Rosenbrock函数,求程序代码?
matlab用最速下降法(梯度法)计算Rosenbrock函数,求程序代码?Rosenbrock函数实现代码:CLC,clear allformat long gx0=[00]乐趣=@funcgfun
matlab用最速下降法(梯度法)计算Rosenbrock函数,求程序代码?
Rosenbrock函数实现代码:CLC,clear allformat long gx0=[00]乐趣=@funcgfun=@gfunc[x,Val,k]=grad(fun,gfun,x0)%最速下降法(梯度法)目标函数f=func(x)f=100*(x(1)^2-x(2))^2(1-x(1))^2末级梯度函数g=gfunc(x)g=[400*x(1)*(x(1)^2-x(2))-x(2)2*(x(1) -200*(x(1)^2-x(2))]如果最终运行结果有任何问题,请向我发送私人消息。用GA()得到的Rosenbrock函数的结果与用上述方法得到的结果接近。