Conjugate Gradient Method:Conjugate Gradient Method 求解线性方程组-matlab开发

时间:2021-05-30 11:46:29
【文件属性】:
文件名称:Conjugate Gradient Method:Conjugate Gradient Method 求解线性方程组-matlab开发
文件大小:2KB
文件格式:ZIP
更新时间:2021-05-30 11:46:29
matlab 共轭梯度法的目的是求解一个线性方程组,Ax=b,其中A是对称的,不需要计算A的逆。它只需要很少的内存,因此特别适用于大规模系统。 如果A条件良好,它比其他方法(例如高斯消去)要快。 例如, n=1000; [U,S,V]=svd(randn(n)); s=诊断(S); A=U*diag(s+max(s))*U'; % 使 A 对称,条件良好b=randn(1000,1); tic,x = conjgrad(A,b); toc tic,x1=A\b;toc 范数(x-x1) 范数(xA*b) 共轭梯度比使用盖斯消元法的 A\b 快两到三倍。
【文件预览】:
conjgrad.zip

网友评论