开发者

Matlab - Sparse Matrix system resolution

I'm involved in the resolution of a system of the type Ax = b, where A is a square sparse matrix, x is the vector of the unknows (I have to compute it) and b is a vector of all zeros excpet for the last element which is a 1. The last开发者_JAVA百科 row of the matrix A is used for normalization, and so is fulfilled with ones.

The solutions of this system are probabilities and for this reason the condition 0<x(i)<1 must be respected.

In order to solve the system the Matlab command x = A \ b; is used.

The method seems to work well, but there is a special case in wich the vector x also contains negative values. Adding a very small value (10^-6) to any element of the Matrix A, the resolution back to meet the conditions.

I'm not a mathematician, so I don't know if it's a code problem, or if the matrix A must respect some properties to guarantee that the solutions are all between 0 and 1.


Sounds like what you really want is: minimize ||Ax-b|| subject to x > 0 for all x. You can do that with function lsqlin : http://www.mathworks.com/help/toolbox/optim/ug/lsqlin.html

The 'must add to 1' is a linear equality constraint, positivity is a linear inequality constraint.

A related problem with probabilities in a matrix (not square) is this: http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=5717139

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜