help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-negative results when solving a set of equations


From: Terje Hansen
Subject: Re: Non-negative results when solving a set of equations
Date: Thu, 5 Jun 2008 14:34:08 +0200


On 5 Jun 2008, at 08:43, Francesco Potorti` wrote:

I have a set of equations (Ax = b) that I can solve with  A\b.
However, due to physical reasons, the result can not contain negative values (they should be zero in that case). I went through the manual and did a
search, but found nothing that could help me.

That depends on what you want.  If you want to "solve" the equations,
there is nothing to do, because you hav a single solution, provided that
A is non-singular.

If you want simply to set negative values to zero, you do:
x=A\b; x(x<0)=0;


The solutions have a physical meaning. If one or more are zero, then these are not present physically in the system, and they have to be excluded. However, in that case the other values could change also, since one or more components are not present.



If you are not satisfied with simply setting the negative components of
the solution to zero, look for function lsqnonneg.

I will look for this. Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]