Re: Non-Negative Least Squares [message #12014] |
Wed, 17 June 1998 00:00 |
William H Dorin IV
Messages: 5 Registered: June 1998
|
Junior Member |
|
|
<HTML>
Peter Scarth wrote:
<BLOCKQUOTE TYPE=CITE>Hi,
<BR>I'm using IDL 5.03 and ENVI to model the canopy size and tree density
from
<BR>Landsat image data. At the moment I'm about to start writing an algorithm
<BR>to find the best fit of x in Ax=b subject to x being non negative.
Whilst I
<BR>haven't been able to find IDL code to give me this, maybe someone out
there
<BR>has been down this path before???
<BR>Any pointers would be greatly appreciated.
<BR>Peter Scarth</BLOCKQUOTE>
I'm not sure I understand, exactly. You have data in the form
<P>b(0), x(0)
<BR>b(1), x(1)
<BR>...
<P>and you wand to fit a function of the form Ax=b for non-negative values
of x(n)?
<P>If this is the case, try this:
<P>xsum=0.0
<BR>bsum=0.0
<BR>for i=(0,n_max) do begin
<BR> if (x(n) ge 0.0) then do begin
<BR> xsum=xsum+x(n)
<BR> bsum=bsum+b(n)
<BR> endif
<BR>endfor
<BR>a=bsum/xsum
<P>I'm sure there's a much faster way using where statements, but I'm still
rather new at IDL, and I don't know the structure of your data arrays
<P>Hope it helps - if I'm totally off on what you want, write me back and
I'll see if I can do what you REALLY want,
<P>Wm.
<PRE>--
****************************
William H Dorin IV
NIS-1, LANL &n bsp;
505-665-7682</PRE>
</HTML>
|
|
|