当前位置: 动力学知识库 > 问答 > 编程问答 >

Numerical Analysis using MATLAB

问题描述:

I was reading how to make use MATLAB to solve a linear equations.

In this chapter, we deal with several numerical schemes for solving a system of equations

a11x1 + a12x2 + ·· ·+a1NxN = b1

a21x1 + a22x2 + ·· ·+a2NxN = b2

. . . . . . . . . = .

aM1x1 + aM2x2 + ·· ·+aMNxN = bM

which can be written in a compact form by using a matrix–vector notation as

A X = b

mxn

where:

 a11 a12 · · a1N

AM×N = a21 a22 · · a2N

· · · · ·

M1 aM2 · · aMN

x1

x= x2

·

xN

b1

b = b2

·

bM

In which we have 3 cases : M=N;M<N;M>N

I was not able to understand the below block:

The Nonsingular Case (M = N)

x = A^−1 b

so long as the matrix A is not singular

>>A = [1 2;2 4]; b = [-1;-1];

>>x = A^-1*b

Warning: Matrix is singular to working precision.

x = -Inf

-Inf

This is the case where some or all of the rows of the coefficient matrix A are

dependent on other rows and so the rank of A is deficient, which implies that

there are some equations equivalent to or inconsistent with other equations. If

we remove the dependent rows until all the (remaining) rows are independent of

each other so that A has full rank (equal to M), it leads to the case of M <N,

which will be dealt with in the next section.

What does 'rank of A is deficient' means and implies thereon?

网友答案:

The error you get means that A can not be inverted. But that does not mean there is no solution. You need not stop now.

If there is a solution it is not unique - you might need to find the subspace it is in.

The keyword is pseudoinverse. In matlab the command pinv. You will get the solution closest to your problem.

eg:

c=pinv(A)*b

it will produce a correct solution (one of many) for A = [1 2;2 4]; b = [-1;-2]; (remember A still is not invertible!) - and for your problem with b=[-1;-1] a close one

网友答案:

If rows of matrix are linearly dependant on each other, the determinant of that matrix is always equal to zero. Here in matrix A, the rows are (1 2) and (2 4) which are linearly dependent i.e. a(1 2) + b(2 4) = 0 where a=2 and b=-1. For any nXn non-singular matrix, rank = n. For a singular matrix, linearly dependent rows are removed and then the determinant is calculated. If that is not equal to zero then the rank = n-1. But if it is again equal to zero, linearly dependant row is removed and now the determinant is calculated. In this case the rank = n-2.

This process is continued till the determinant converges to zero

分享给朋友:
您可能感兴趣的文章:
随机阅读: