【正文】
egration% A is 1N vector of abscissas from the table% w is 1N vector of wights from the table%Output quad is the quadrature valueN = length(A)。For k=N1:1:1 x(k)=(y(k)A(k,k+1:N)*x(k+1:N))/A(k,k)。endend%solve for yy(1)=b(R(1))。A(k,p)=mult。if a(p,p)==0‘A is singular. No unique solution’breakend%Calculate multiplier and place in sundiagonal portion of AFor k=p+1:N mult=A(k,p)/A(p,p)。R(p)= R(j+p1)。A(j+p1,:)=c。% Interchange row p and j c=A(p,:)。R=1:1。y=zeros(N,1)。 數(shù) 值 實(shí) 驗(yàn)數(shù)值實(shí)驗(yàn)1 線性方程組求解一、方法與程序1.:帶選主元的分解法(MATLAB程序)Function x =lufact(A,b)% Input A is an NN matrix% b is N1 matrix%Output x is an N1 matrix containing the solution to Ax=b%Initialize x, y, the temporary storage matrix C, and the row%permutation information matrix R[N,N]=size(A)。x=zeros(N,1)。c=zeros(N,1)。For k=1:N1% Find the pivot row for colum p[max1,j]=max (abs(A(p:N,p)))。 A(p,:)=A(j+p1,:)。D=R(p)。R(j+p1)=d。 A(p,:)=A(j+p1,:)。A(k,p+1:N)= A(k,p+1:N)mult* A(p,p+1:N)。For k=2:N Y(k)=b(R(k))A(k,1:k1)*y(1:k1)end%solve for xx(N)=y(N)/A(N,N)。end二、數(shù)值試驗(yàn)內(nèi)容1)用帶選主元的分解法求解線性方程組,其中 和