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: Jaroslav Hajek
Subject: Re: Non-negative results when solving a set of equations
Date: Thu, 5 Jun 2008 08:51:41 +0200

On Thu, Jun 5, 2008 at 8:43 AM, Francesco Potorti` <address@hidden> 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;
>
>>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?
>

lsqnonneg is already part of Octave. If it is not in 3.0.1 (I'm not
sure now), it will be in 3.0.2.
Can't comment further, I haven't seen the code and I have never used it.

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



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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