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

Home » Public Forums » archive » cubic spline fitting
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: cubic spline fitting [message #89685 is a reply to message #89684] Thu, 13 November 2014 18:50 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
The documentation gives an example of how to call spl_init and spl_interp

X = (FINDGEN(21)/20.0) * 2.0 * !PI
Y = SIN(X)
; Calculate interpolating cubic spline:
Y2 = SPL_INIT(X, Y)
; Define the X values P at which we desire interpolated Y values:
X2= FINDGEN(11)/11.0 * !PI
; Calculate the interpolated Y values corresponding to X2[i]:
result = SPL_INTERP(X, Y, Y2, X2)
PRINT, result

Note that
(1) there is no comma prior to the parentheses
(2) one must set the output equal to a variable e.g. Y = SPL_INTERP(X,Y,Y2,X2)

The confusion may be due to the fact that IDL has both procedure calls and function calls, with quite different syntax.


On Thursday, November 13, 2014 9:18:36 PM UTC-5, ian....@mq.edu.au wrote:
> I am trying to use the IDL routines
>
> spl_init and spl_interp
>
> to do a cubic spline fit to variables that are vectors with 45 elements.
> ie y is not a function of x.
>
> I am getting 2 compilation errors where it seems to be objecting to using a vector for y instead of y being a function of x.
>
> IDL> .compile -v 'C:\Ian_Plots\complines 27102014 FYZ Clumps SiO 2-1 and 5-4 Peak Tbs dV30.pro'
> % Compiled module: LOAD_MOLDATA.
>
> spl_init,(x_nH_5,y_Tb13N_5,double)
> ^
> % Syntax error.
> At: C:\Ian_Plots\complines 27102014 FYZ Clumps SiO 2-1 and 5-4 Peak Tbs dV30.pro, Line 476
>
> spl_interp,(x_nH_5,y_Tb13N_5,x2_nH_5,y2_13N_5,double)
> ^
> % Syntax error.
> At: C:\Ian_Plots\complines 27102014 FYZ Clumps SiO 2-1 and 5-4 Peak Tbs dV30.pro, Line 481
> % 2 Compilation error(s) in module $MAIN$.
>
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: CGHISTOPLOT - How to make inward X-axis tick marks?
Next Topic: N3 (authomatic correction of intensity in MRI data)

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

Current Time: Fri Oct 10 00:58:46 PDT 2025

Total time taken to generate the page: 1.83831 seconds