玫瑰函數(shù)圖像 matlab用最速下降法(梯度法)計算Rosenbrock函數(shù),求程序代碼?
matlab用最速下降法(梯度法)計算Rosenbrock函數(shù),求程序代碼?Rosenbrock函數(shù)實現(xiàn)代碼:CLC,clear allformat long gx0=[00]樂趣=@funcgfun
matlab用最速下降法(梯度法)計算Rosenbrock函數(shù),求程序代碼?
Rosenbrock函數(shù)實現(xiàn)代碼:CLC,clear allformat long gx0=[00]樂趣=@funcgfun=@gfunc[x,Val,k]=grad(fun,gfun,x0)%最速下降法(梯度法)目標(biāo)函數(shù)f=func(x)f=100*(x(1)^2-x(2))^2(1-x(1))^2末級梯度函數(shù)g=gfunc(x)g=[400*x(1)*(x(1)^2-x(2))-x(2)2*(x(1) -200*(x(1)^2-x(2))]如果最終運行結(jié)果有任何問題,請向我發(fā)送私人消息。用GA()得到的Rosenbrock函數(shù)的結(jié)果與用上述方法得到的結(jié)果接近。