Solving a matrix in MATLAB?

2019-04-06 05:55发布

How does one solve the (non-trivial) solution Ax = 0 for x in MATLAB?

A = matrix
x = matrix trying to solve for

I've tried solve('A * x = 0', 'x') but I only get 0 for an answer.

4条回答
Root(大扎)
2楼-- · 2019-04-06 06:33

null(A) will give you the direct answer. If you need a nontrivial solution, try reduced row echelon form and refer the first page of the pdf.

R = rref(A)

http://www.math.colostate.edu/~gerhard/M345/CHP/ch7_4.pdf

查看更多
Juvenile、少年°
3楼-- · 2019-04-06 06:40

You can use N = null(A) to get a matrix N. Any of the columns of N (or, indeed, any linear combination of columns of N) will satisfy Ax = 0. This describes all possible such x - you've just found an orthogonal basis for the nullspace of A.

Note: you can only find such an x if A has non-trivial nullspace. This will occur if rank(A) < #cols of A.

查看更多
小情绪 Triste *
4楼-- · 2019-04-06 06:43

You can see if MATLAB has a singular value decomposition in its toolbox. That will give you the null space of the vector.

查看更多
太酷不给撩
5楼-- · 2019-04-06 06:46

Please note that null(A) does the same thing (for a rank-deficient matrix) as the following, but this is using the svd(A) function in MATLAB (which as I've mentioned in my comments is what null(A) does).

[U S V] = svd(A);
x = V(:,end)

For more about this, here's an link related to this (can't post it to here due to the formulae).

If you want a more intuitive feel of singular and eigenvalue decompositions check out eigshow in MATLAB.

查看更多
登录 后发表回答