Re: correct way to use INTERPOLATE function [message #55967 is a reply to message #55966] |
Fri, 21 September 2007 14:59   |
R.G.Stockwell
Messages: 163 Registered: October 2004
|
Senior Member |
|
|
"Ryan." <rchughes@gmail.com> wrote in message
news:1190411412.834849.94160@g4g2000hsf.googlegroups.com...
>> you probably shouldn't be doing that in the first place.
>
> Hi Bob,
>
> I was actually looking over the validity of what I was doing after I
> posted it. I wasn't certain that what I was doing correctly
> represented what I wanted. Thanks for confirming my thoughts. I got
> sidetracked on what I originally wanted to show. I got busy trying to
> debug my code and ended up doing something I shouldn't. I got
> sidetracked with IDL repeatedly crashing out on me because I was
> unintentionally Interpolating a string (Not a good idea, by the way)
> and spent much time on this. Then I got busy trying to get the
> INTERPOLATE or CONGRID functions to work properly. I will rethink my
> original intentions and hopefully stay on track this time. =)
>
> Thanks for pointing it out,
> Ryan.
You are welcome.
I don't mean to overstate the "shouldn't do it" part. Interpolation
is common and usually a fine thing to do.
The part that stood out for me was taking the original array with
10 elements and no x-values related to those 10 elements.
That is fine, because most people use the index number as the
x-coordinate of the data. So you have x = 0,1,2...9.
Then the example is "interpolating" the original data "s" onto an
array "l" that goes from 0 to 49.5. That is outside the bounds of
the original index (the 0,1,..9) so it doesn't make sense.
If you interpolated onto a finer scale than the integer index,
(from 0,1,2...9 to a new x-value array of 0,0.1,0.2,0.3....... 9.0
then that would be fine). That's all I was really getting at.
Cheers,
bob
PS interpolating strings should be able to work
for instance
x = 'liberal'
x2='conservative'
z = interpol([x,x2], 0.5)
print, result
> moderate
sorry, dumb attempt at a joke
|
|
|