Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

spline

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Does a cubic spline interpolation of a data set.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = spline(Ex,xold,xnew);

Cubic spline interpolation of a 1D function.

Ex is an existing data set

xold specifies the points where Ex is sampled

xnew specifies new points to interpolate the data.

The points in xnew do not have to be within the bounds of xold.

 

Example

Resample Ex at xnew using cubic spline and linear interpolation methods. Note that xnew is outside the bounds of xold.

xold=linspace(0,10,7);

Ex=sin(xold);

xnew=linspace(-1,9,25); # defining a new x vector

Exnew=interp(Ex,xold,xnew); # interpolating the new data set

 

Exnew2=spline(Ex,xold,xnew); # smoothing

 

plotxy(xold,Ex,xnew,Exnew,xnew,Exnew2,"x","y","");

legend("old data", "interp", "Spline");

 

The example code will generate the plot below. The figure shows the difference between the linear and cubic spline interpolation techniques.

ref_fdtd_scripts_spline_ex1_zoom80

 

See Also

Functions, interp, plotxy

Copyright Lumerical Inc. | Privacy | Site Map