-
matlab程序实现共轭梯度法
资源介绍
共轭梯度法matlab程序
function x = cg(A,b)
tol=1e-10;
r = b + A*b;
w = -r;
z = A*w;
s = w'*z;
t = (r'*w)/s;
x = -b + t*w;
for k = 1:numel(b);
r = r - t*z;
if( norm(r) < tol )
return;
end
B = (r'*z)/s;
w = -r + B*w;
z = A*w;
s = w'*z;
t = (r'*w)/s;
x = x + t*w;
end
- 上一篇: 粒子群(PSO)优化的粒子滤波(PF)
- 下一篇: PSO(微粒群算法)matlab工具箱