PDA

查看完整版本 : 【求助】请教问题


ghack
2007-12-15, 01:58
Solving Ax=b

Purpose
To use gauss, swap, scale, replace, x= =y, length, and lead to study existence questions for the equation Ax=b and Theorem 4 of Section 1.4 of the text.

MATLAB Functions
swap, scale, replace, gauss, lead

We can use the Laydata functions swap, scale, and replace to row reduce a matrix. We will use the following matrix to see how they work:
A=rand(3,4)
The function swap has the form Y = swap(A, r, s), where the outcome Y is the result of interchanging rows r and s of A. So, even though swapping rows is not necessary to the row reduction of A, you can see how it works with
r=1; s=3;
A=swap (A, r, s)
To obtain a one in the (1,1) pivot position, use scale in the form scale(A, r, c), which scales row r of matrix A by a nonzero scalar c.
r=1; c=1/A(1,1);
A=scale(A, r, c)

To zero out the entry in the (2,1)position use replace in the form Y=replace(A,r,m,p), which replaces row r of matrix A by its sum whth m times row p.
r =2;m=-A(2,1);p=1;
A=replace(A,r,m,p)
To finish the first column use
r =3;m=-A(3,1);p=1;
A=replace(A,r,m,p)
The Laydata function Y=gauss(A,r) can be used to zero out below a pivot entry in row r. start over with
A=rand(3,4)
A=gauss(A,1)
A=gauss(A,2)
A=gauss(A,3)

The Laydata function lead in the form L= lead (A) returns a vector L containing the indices for the columns of the pivots ( or leading ones) in the reduced row echelon form. With the form [L,F] = lead(A), the vector F contains the indices for non-pivot columns. Together, the two vectors contain all numbers 1,2,…n where n is the number of columns.
Suppose we want to know if Ax= b is consistent. We look at [L,F] = lead ([A,b]) to see if there is a leading one in the augmented column. If n is the number of columns of A, we want to determine if n+1 is in the vector F.The numbers of L and F are arranged in order, and n+1 IS THE LARGEST INDEX FOR A COLUMN OF THER AUGMENT MATRIX. THE matlab function length (F) will find the number of entries in F. thus, either F(length(F)) is n+1. so
F(length(F)) == n+1
Will return 1 if and only if there is not a leading one in the augmented column of rref ([A,b]).
1 Suppose [L,F]=lead([A,b]) and n=size(A,2). Which of the following can be used to determine if Ax=b is consistent?
a. L(length(L))==n
b. 1-L(length(L))==n+1
c. Max(L)<max(F)
d. Find(F==n+1)
e. Min(L)>max(F)
2 Suppose [L,F]=lead([A,b])and [m,n]=size(A,2) which of the following can be used to determine if Rm(应该是m维空间)=Span{v1,v2,…,v3}?
a. max(F)>max(L)
b. length(L)==m
c. max([L,F])
d. length(F)==n-length(L)
e. F==[ ]
求程序并加以注释。。。