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: Francesco Potorti`
Subject: Re: Non-negative results when solving a set of equations
Date: Thu, 05 Jun 2008 08:43:35 +0200

>> 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;

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

Interesting.  Is there a free implementation for Octave?

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

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