comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Non-Negative Least Squares
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Non-Negative Least Squares [message #12014] Wed, 17 June 1998 00:00
William H Dorin IV is currently offline  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>
&nbsp;I'm not sure I understand, exactly.&nbsp; 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>&nbsp;&nbsp;&nbsp; if (x(n) ge 0.0) then do begin
<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; xsum=xsum+x(n)
<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; bsum=bsum+b(n)
<BR>&nbsp;&nbsp;&nbsp; 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>--&nbsp;
&nbsp;&nbsp;&nbsp; ****************************
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; William H Dorin IV&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NIS-1, LANL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 505-665-7682</PRE>
&nbsp;</HTML>
[Message index]
 
Read Message
Previous Topic: UTM to LatLon conversion in libraries?
Next Topic: IDL star_map procedure???

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 14:48:57 PDT 2025

Total time taken to generate the page: 0.33879 seconds