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

Home » Public Forums » archive » Re: Non-linear data selection
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-linear data selection [message #71000 is a reply to message #70998] Sat, 15 May 2010 17:27 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Joe Daal writes:

> There is an interesting problem that I often come across.....
> I have a scattered dataset of x and y, say 1000 elements each. The
> data could be of any shape, for now, let's assume it is scattered
> allover the X-Y window.
>
> There is straight line (y=mx+b, could be some other curve as well)
> that that crosses the plot, I need to select all data points this
> line.
> If it is just a one value for y, the WHERE statement is ok, but how to
> do this?

x = Randomu(-3L, 100) * 10
y = Randomu(-5L, 100) * 10
m = 0.5
b = 3.25
yfit = m*x+b
aboveIndices = Where((y GE yfit) EQ 1, count)
Print, StrTrim(count,2) + ' points lie above the line.'

Plot, x, y, /NoData, Background=FSC_Color('white')
OPlot, x, y, PSYM=2, SYMSIZE=0.5, Color=FSC_Color('sky blue')
OPLOT, x[aboveIndices], y[aboveIndices], PSYM=4, Color=FSC_Color('red')
OPlot, x, yfit, LINESTYLE=2


Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Vertical Data in Google Earth KML
Next Topic: Viewing Shapefiles in IDL

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

Current Time: Wed Oct 08 15:28:13 PDT 2025

Total time taken to generate the page: 0.00448 seconds