1 / 31

第三节 用矩阵分解法求解线性方程组

第三节 用矩阵分解法求解线性方程组. 七、 三对角方程组的解法. lupdsv.m % 功能:调用列主元三角分解函数 [LU,p]=lupd(A) % 求解线性方程组 Ax=b 。 % 解法: PA=LU, Ax=b←→PAx=Pb % LUx=Pb, y=Ux % Ly=f=Pb, f(i)=b(p(i)) % 输入:方阵 A ,右端项 b (行或列向量均可) % 输出:解 x (行向量). function x=lupdsv(A,b) n=length(b); [LU,p]=lupd(A);

fauve
Télécharger la présentation

第三节 用矩阵分解法求解线性方程组

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第三节 用矩阵分解法求解线性方程组 七、 三对角方程组的解法

  2. lupdsv.m %功能:调用列主元三角分解函数[LU,p]=lupd(A) % 求解线性方程组Ax=b。 %解法:PA=LU, Ax=b←→PAx=Pb % LUx=Pb, y=Ux % Ly=f=Pb, f(i)=b(p(i)) %输入:方阵A,右端项b(行或列向量均可) %输出:解x(行向量)

  3. function x=lupdsv(A,b) n=length(b); [LU,p]=lupd(A); y(1)=b(p(1)); for i=2:n y(i)=b(p(i))-LU(i,1:i-1)*y(1:i-1)'; end x(n)=y(n)/LU(n,n); for i=(n-1):-1:1 x(i)=(y(i)-LU(i,i+1:n)*x(i+1:n)')/LU(i,i); end

  4. lupqdsv.m %功能:调用全主元三角分解函数[LU,p,q]=lupqd(A) % 求解线性方程组Ax=b。 %解法:PAQ-1=LU, Ax=b←→(PAQ-1)(Qx)=Pb % LU(Qx)=Pb, z=Qx, y=Uz % Ly=f=Pb, f(i)=b(p(i)) % Uz=y, z=Qx , x(q(i))=z(i). %输入:方阵A,右端项b(行或列向量均可) %输出:解x(行向量)

  5. function x=lupqdsv(A,b) n=length(b); [LU,p,q]=lupqd(A); y(1)=b(p(1)); for i=2:n y(i)=b(p(i))-LU(i,1:i-1)*y(1:i-1)'; end z(n)=y(n)/LU(n,n);x(q(n))=z(n); for i=(n-1):-1:1 z(i)=(y(i)-LU(i,i+1:n)*z(i+1:n)')/LU(i,i); x(q(i))=z(i); end

  6. 定义1若n阶矩阵A=(aij)的元素满足:对于1<p,q<n的正整数p、q,有j≥i+p及i≥j+q时,aij=0,则A称为带状矩阵. 带宽为w=p+q-1。 七、 三对角方程组的解法 较常见带状矩阵为带宽为3(p=q=2,w=3)的矩阵。 A称为三对 角矩阵。 系数矩阵为三对角矩阵的线性方程组称为三对角方程组。

  7. 三对角线性方程组 应用追赶法求解三对角线性方程组。追赶法仍然 保持LU分解特性,它是一种特殊的LU分解。充分利用 了系数矩阵的特点,而且使之分解更简单,得到对三对 角线性方程组的快速解法。

  8. 定理如果带宽为 w=p+q-1 的n阶带状矩阵A有LU 分解:A=LU,则L是带宽为p的下三角矩阵,U是带宽 为q的上三角矩阵。

  9. 求解Ly=b, y1=1, y2=1.5, y3=1, y4=0.5 求解Ux=y , x4=0.3333, x3=-0.3333, x2=-1, x1=-1

  10. 周期三对角方程组的一般形式 基本思想:利用谢尔曼-莫里森公式(Sherman-Morrison)将方程化为三对角方程求解。

  11. 谢尔曼-莫里森公式(Sherman-Morrison)

  12. 如何选取U,V

  13. 二版习题 P115----15 , 16 三版习题 P138----10 , 11

More Related