Re: union or overlap of two plots [message #61607] |
Tue, 22 July 2008 09:26  |
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
|
|
|