({{, (RefLink[InterpolationOrder, paclet:ref/InterpolationOrder]) 
is an option for (RefLink[Interpolation, paclet:ref/Interpolation]), as well as (RefLink[ListLinePlot, paclet:ref/ListLinePlot]), (RefLink[ListPlot3D, paclet:ref/ListPlot3D]), (RefLink[ListContourPlot, paclet:ref/ListContourPlot]), and related functions, that specifies what order of interpolation to use.}})

OpenersNotesSection(Spacer1)Details

(RefLink[InterpolationOrder, paclet:ref/InterpolationOrder])->n specifies that polynomials of degree n should be fitted between data points.

For multidimensional data, the polynomials are taken to be of degree n in each variable.

(RefLink[InterpolationOrder, paclet:ref/InterpolationOrder])->(RefLink[None, paclet:ref/None]) specifies that data points in plots should be joined without interpolation.

(RefLink[InterpolationOrder, paclet:ref/InterpolationOrder])->0 yields a collection of flat regions, with steps at each data point.

(RefLink[InterpolationOrder, paclet:ref/InterpolationOrder])->1 joins data points with straight lines in 2D, and with piecewise polygonal surface elements in 3D.

Higher interpolation orders generally lead to increasingly smooth curves or surfaces.

In functions such as (RefLink[NDSolve, paclet:ref/NDSolve]), (RefLink[InterpolationOrder, paclet:ref/InterpolationOrder])->(RefLink[All, paclet:ref/All]) specifies that the interpolation order should be chosen to be the same as the order of the underlying solution method.

(RefLink[InterpolationOrder, paclet:ref/InterpolationOrder]) can also be used in functions like (RefLink[Manipulate, paclet:ref/Manipulate]), to specify the smoothness of animations between control points such as bookmarks.

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Use different interpolation orders for curves:

data = {{0,0},{1,2},{3,4},{4,2},{6,0}};

Table[ListLinePlot[data, InterpolationOrder->n],{n,{0,1,3}}]

Use different interpolation orders for surfaces:

data=Table[Sin[x y],{x,0,4,0.5},{y,0,4,0.5}];

Table[ListPlot3D[data,InterpolationOrder->n,Mesh->None],{n,{0,1,3}}]

Use different interpolation orders when constructing an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]):

data = {{0,0},{1,2},{3,4},{4,2},{6,0}};

Table[Plot[Evaluate@Interpolation[data,InterpolationOrder->n][x],{x,0,6}],{n,{0,1,3}}]

OpenersExampleSection1(Spacer1)Scope  (4)

Use piecewise quintic interpolation to approximate the sine function:

ifun = Interpolation[Table[{x,Sin[π x]},{x,0,1,.1}],InterpolationOrder->5]

Show the approximation error:

Plot[Sin[π x]-ifun[x],{x,0,1}]

Show the smoothing effect of higher interpolation order in plotting:

data = {0,0,1,0,0};

Table[ListLinePlot[data, InterpolationOrder->order],{order,0,3}]

Show the smoothing effect of higher interpolation order for (RefLink[GCD, paclet:ref/GCD]) data:

data = Array[GCD,{10,10}];

Table[ListPlot3D[data,InterpolationOrder->order,PlotRange->{0,10},Mesh->None],{order,{0,1,3,9}}]

Get a solution that uses interpolation of the same order as the method from (RefLink[NDSolve, paclet:ref/NDSolve]):

Timing[a = NDSolve[{x'[t] == y[t], y'[t]== -x[t],x[0]==1, y[0]==0},{x,y},{t,0,1000},InterpolationOrder->All]]

This is more time consuming than the default interpolation order used:

Timing[d = NDSolve[{x'[t] == y[t], y'[t]== -x[t],x[0]==1, y[0]==0},{x,y},{t,0,1000}]]

It is much better in between steps:

Plot[Evaluate[{First[x[t] /. a],First[x[t]/. d]} - Cos[t]],{t,0,10}, PlotRange->All, PlotStyle->{Directive[Thick, Blue],Red}]

OpenersExampleSection3(Spacer1)Possible Issues  (1)

Very high-order interpolation can lead to large errors:

f[x_] := 1/(1+25 x^2);

points=Table[{x,f[x]},{x,-1,1,.1}];

Interpolate with order 20:

if20 = Interpolation[points, InterpolationOrder->20]

Plot[if20[x],{x,-1,1}, PlotRange->All]

Piecewise interpolation with lower order makes a much better approximation:

if3 = Interpolation[points];
Plot[if3[x],{x,-1,1}]

Show the approximation error for different interpolation orders:

Table[ifn=Interpolation[points,InterpolationOrder->order];
Plot[ifn[x] - f[x],{x,-1,1},PlotRange->All,BaselinePosition->Axis],{order,{3,9,12}}]

OpenersExampleSection4(Spacer1)Neat Examples  (1)

Zero-order interpolation, with Voronoi cells having the constant value:

ListPlot3D[RandomReal[1,{100,3}],InterpolationOrder->0,Filling->Axis,Mesh->None,PlotRange->All,ColorFunction->"Rainbow"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Interpolation, paclet:ref/Interpolation])  ▪  (RefLink[FunctionInterpolation, paclet:ref/FunctionInterpolation])  ▪  (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction])  ▪  (RefLink[ListLinePlot, paclet:ref/ListLinePlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Plotting Options, paclet:guide/PlottingOptions])}, {▪(RefLinkPlain[System Model Simulation, paclet:guide/SystemModelSimulation])}})}})