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

Home » Public Forums » archive » Re: union or overlap of two plots
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: union or overlap of two plots [message #61607] Tue, 22 July 2008 09:26 Go to previous message
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Jul 22, 3:59 pm, kedmond <kedm...@gmail.com> wrote:
> Chris,
>
> Thanks for the quick response. Your solution worked amazingly
> well....now I have to sit and figure out why!

All I'm doing is finding out which is the lower of the two values for
each point in the dataset with the MIN call, and storing the result in
YMin. Then I'm using integration to find the area under the new YMin
curve.

> To make the min()
> function work, I had to set y1 and y2 equal to their transpose() since
> min() wants the data to be in vector form. Once I did that, your
> instructions work as stated.

Yes, I had forgotten that PLOT will automatically 'flatten out' the
input in a way that array concatenation won't.
I guess to make the solution more general you could add in the Reform
command before the concatenation:

ny = N_Elements(y1)
FlatY1 = Reform(y1, ny)
FlatY2 = Reform(y2, ny)
YMin = Min([[FlatY1], [FlatY2]], Dim = 2)

Here's some tutorials to help you figure out what IDL's doing here:
http://www.dfanning.com/tips/rebin_magic.html
http://www.dfanning.com/tips/array_concatenation.html

The second one explains what all the square brackets are doing, but
I've found it's far easier to get your head around if you take the
time to read the first one beforehand!

>
> Thanks again.
>
> -Kazem

All the best,
Chris
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: newbie wants to enforce "array conservation"
Next Topic: protect our programs from others

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

Current Time: Wed Oct 08 19:03:48 PDT 2025

Total time taken to generate the page: 0.00476 seconds