As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [interpolation]

Questions on the interpolation functions in Mathematica (InterpolatingFunction[], Interpolation[], ListInterpolation[], FunctionInterpolation[], InterpolatingPolynomial[], etc.)

Filter by
Sorted by
Tagged with
60 votes
1 answer
3k views

What's inside InterpolatingFunction[{{1., 4.}}, <>]?

I'm curious what's inside the InterpolationFunction object? For example: ...
xslittlegrass's user avatar
46 votes
5 answers
2k views

How can the behavior of InterpolationOrder->0 be controlled?

In ListPlot and Interpolation, the option InterpolationOrder->0 uses two different ...
ArgentoSapiens's user avatar
42 votes
2 answers
7k views

How does Interpolation really work?

I'm looking for some explanation or advice, not help in solving something. Recently I finished my program and my supervisor said "Ok, now it's time for your first paper: write a scientific text about ...
ddd's user avatar
  • 561
41 votes
6 answers
6k views

How to splice together several instances of InterpolatingFunction?

I have a set of InterpolatingFunction returned by NDSolve which are valid over different (but overall continuous) domains. How ...
polyglot's user avatar
  • 745
41 votes
5 answers
15k views

My Girlfriend is going to prison...Save her with Math

Salacious title, but true story. ...
Prisoners Dilema's user avatar
37 votes
7 answers
10k views

Extracting the function from InterpolatingFunction object

I've used Interpolation[] to generate an InterpolatingFunction object from a list of integers. ...
Seleren's user avatar
  • 473
35 votes
3 answers
2k views

No warning when extrapolating with Plot

One of the most annoying "features" of Mathematica is that the Plot family does extrapolation on InterpolatingFunctions without ...
István Zachar's user avatar
34 votes
2 answers
6k views

Joining and interpolating data points

I wonder what is the best practice for interpolating curves? Usually, I'm using BSplineCurve and adjusting SplineWeights so it ...
swish's user avatar
  • 7,541
32 votes
4 answers
2k views

How can I adaptively simplify a curved shape?

For the purposes of creating a publication-quality plot marker I wish to convert a font glyph into a simplified Polygon where points are taken adaptively according ...
Alexey Popkov's user avatar
32 votes
3 answers
3k views

Arbitrary precision spline interpolation

The current implementation of Interpolation does not allow arbitrary precision spline interpolation. Yu-Sung Chang says here that "it is not hard to implement it ...
Alexey Popkov's user avatar
31 votes
6 answers
13k views

Finding the intersection of a curve with an interpolation function

There are no issues trying to find the intersection points of two defined curves. ...
Zviovich's user avatar
  • 9,248
27 votes
4 answers
8k views

Data interpolation and ListContourPlot

I am fairly new to Mathematica and I have two quick questions on using it for a Hydrology and Hydrogeology class. One is about data interpolation and interpolating without any data defined in an area. ...
John Lombardi's user avatar
24 votes
4 answers
5k views

How to integrate functions of linearly interpolated data?

At first, consider integration of pure InterpolatingFunction. Importing some data (works in v.9, for earlier versions one can use this link to download zipped <...
Alexey Popkov's user avatar
24 votes
4 answers
2k views

How to reduce the InterpolatingFunction building overhead?

I want a linear interpolation from the following example list: ...
P. Fonseca's user avatar
  • 6,635
24 votes
2 answers
2k views

ListContourPlot interpolation fails if x and y axes have different scales

To summarize what is below: ListContourPlot doesn't work when the domain has different x and y scales (fails when x/y~10^4, which seems surprisingly small). Is it possible to call ListContourPlot on ...
ninemileskid's user avatar
24 votes
2 answers
2k views

Easy way to plot ODE solutions from NDSolve?

Inspired by the closed question Beautify a NDSolve Graph ! and a comment someone made to me not too long ago: Is there some quick way to plot NDSolve results ...
Michael E2's user avatar
  • 228k
24 votes
1 answer
890 views

Mismatch between Mathematica and COMSOL in 3D FEM problem

I would like to solve an advection-diffusion problem on a torus domain. There are three Dirichlet conditions: One at the inlet (concentration $c=0$), one at the outlet ($c=0.5$) and one at the wall ($...
Alexander Erlich's user avatar
23 votes
4 answers
11k views

Getting the interpolation function from a list plot

I have conducted a chemistry experiment and obtained a list of concentrations of a reactant against time. I plot a graph of this using Mathematica's ListPlot ...
Thomas Russell's user avatar
22 votes
3 answers
3k views

Monotone, periodic 1d-interpolation with continuous 1st order derivative

Lately, we had this thread about interpolation where J. M. linked two interpolation methods. The background for my question is that I estimated a parameter in polar coordinates with dependence on the ...
halirutan's user avatar
  • 112k
21 votes
3 answers
3k views

Parametric Interpolation of 2D data

I want to create an interpolation through the following 2dim data points: ...
Martin's user avatar
  • 313
21 votes
2 answers
3k views

Higher order periodic interpolation (curve fitting)

I have a list of points in 3D, and I want to get a smooth interpolation or curve fit (it is more for illustration) of these points such that the first and second derivatives at the start and end ...
warsaga's user avatar
  • 541
21 votes
4 answers
3k views

Interpolating data with a step

Suppose I have some data with a step in it: data = {{1, 1}, {2, 2}, {3, 3}, {3, 4}, {4, 5}, {5, 6}}; Interpolation will complain about this and not give you an ...
wxffles's user avatar
  • 14.2k
21 votes
1 answer
648 views

How to fix broken InterpolatingFunction?

Bug introduced in 8.0 and fixed in 9.0.0 I have an InterpolatingFunction based on irregularly-gridded data, like this: ...
JxB's user avatar
  • 5,011
21 votes
2 answers
841 views

Object separation from a 2.5D surface

I'm trying to identify the shape and the boundaries of objects. The data was generated with a laser scanner and represent the surface of an area in which many boulders lay on the ground and making up ...
zeckra's user avatar
  • 441
20 votes
2 answers
19k views

interpolation of 3D data

I have a 3D surface given in data-points of the form ${x,y,z}$. What is the easiest way to get the interpolated value $z=f(X,Y)$ for given coordinates ${X,Y}$ (which are of course not in the data list)...
pawel_winzig's user avatar
  • 1,567
20 votes
2 answers
10k views

Find maximum value of interpolation function - obviously wrong result

Minimizing and maximizing interpolation function has already been asked and answered, see here for example. Yet, I observe a strange behaviour. Well, I can understand that the wrong guess of ...
anderstood's user avatar
  • 14.1k
20 votes
2 answers
3k views

Fast Spherical Linear Interpolation of list of quaternions

An accurate way to interpolate between two quaternions is to use Spherical Linear Interpolation (Slerp) because it preserves the unit length, whereas straightforward linear interpolation does not, as ...
JxB's user avatar
  • 5,011
20 votes
1 answer
1k views

How can I smooth a 3D surface generated by RegionBoundary?

I have a set of points that belong to the surface of an object. I would like to approximate a surface to which I can compute the distance. of other points. With the nice code of this post, I was able ...
g3kk0's user avatar
  • 3,298
19 votes
2 answers
3k views

Inflection point and curvature

Through a coordinates list and then interpolating them I got a $f[x]$. ...
LCarvalho's user avatar
  • 9,145
19 votes
2 answers
694 views

Adding Regularisation to Built-in Interpolation function

tl;tr; How to improve performance of regularised Interpolation? Context Since Version 12, Mathematica now incorporates a range of (underrated IMHO) regularisation ...
chris's user avatar
  • 22.4k
18 votes
3 answers
9k views

Creating a 3D List Line Plot From Discrete Points

Given the following Runge-Kutta ODE solver and the graphical output below, how do I get a 3D line plot instead of a 3D point plot? I see that there is no ListLinePlot3D function, so I thought it might ...
InquisitiveInquirer's user avatar
18 votes
4 answers
1k views

Quirk in VertexColors interpolation when displaying Polygon

When using VertexColors, the docs state: The interior of the polygon is colored by interpolating between the colors specified by ...
jVincent's user avatar
  • 14.7k
18 votes
2 answers
2k views

Improved interpolation of mostly-structured 3d data

This question arose in response to a comment by Leonid to my answer for this question. He noted that for unstructured grids, Interpolation can only use ...
Eli Lansey's user avatar
  • 7,419
17 votes
3 answers
3k views

2D smoothing spline interpolation

Does Mathematica have 2D smoothing spline interpolation built in? I requires an interpolation method with smooth first derivatives and cubic bivariate splines fulfill this nicely. In python I would ...
Ajasja's user avatar
  • 13.5k
17 votes
2 answers
3k views

Getting an InterpolatingFunction from a ContourPlot

I have a function, say minimizeme[Ω_][β_][ϵ_] = ϵ^2 Ω - Log[2 (Cosh[2 β] + Cosh[2 β ϵ])]/(2 β); I want to find its critical points in $\epsilon$ for a given ...
Editortoise-Composerpent's user avatar
17 votes
2 answers
2k views

Interpolation on a regular square grid spanning a triangular domain

Bug introduced in 10.0 and fixed in 10.1 Context I am trying to identify contours of a function which is sampled on a cartesian grid within an irregular (triangular) region. Here is the data ...
chris's user avatar
  • 22.4k
17 votes
1 answer
14k views

How do I prevent NIntegrate::inumr errors within other functions?

I believe this question is best illustrated with a simple example. If I run FunctionInterpolation[NIntegrate[a + b, {a, 0, 1}], {b, 0, 1}] I get errors of the ...
David Z's user avatar
  • 4,841
16 votes
2 answers
1k views

The only usage for the option InterpolationOrder in NDSolve is to be set to All?

We know that changing the option InterpolationOrder in ListLinePlotListPlot3D、...
xzczd's user avatar
  • 60.8k
16 votes
2 answers
781 views

Finite Element Method and ElementMeshInterpolation issue in v10.3

Bug introduced in 10.3 I recently installed Mathematica v10.3 and checked a project I was working on few months ago under Mathematica v10.1. In this project I solve a PDE with ...
unlikely's user avatar
  • 7,033
16 votes
2 answers
2k views

Changing the `ExtrapolationHandler` Function in Any Interpolation

This is a related question to What's inside InterpolatingFunction[{{1., 4.}}, <>]? and Suppress extrapolation of interpolating function in a ContourPlot. When interpolating a set of points,...
AlQuemist's user avatar
  • 291
16 votes
2 answers
465 views

Temporal database reconstruction in mathematica

<EDIT> after some internet research I found the database domain that deals with this kind of thing: Temporal Databases. I think my question therefore becomes how to reconstruct a temporal ...
Hagmonk's user avatar
  • 558
15 votes
3 answers
7k views

Suppress extrapolation of interpolating function in a ContourPlot

I have defined an interpolating function, myfcn[x], valid on the domain x = 0 to 1.5. I am then using ...
user avatar
15 votes
3 answers
1k views

Make an offset curve (parallel curve)

I have a polynomial curve that I got through interpolation. ...
LCarvalho's user avatar
  • 9,145
15 votes
2 answers
1k views

How to add an interpolating point to InterpolatingFunction?

Suppose I have an InterpolatingFunction object defined on $[\epsilon,1]$; let's call it f. What is the best way to construct a ...
faleichik's user avatar
  • 12.6k
15 votes
2 answers
2k views

Data extraction from a picture of a graph

How can I extract data from this picture of a graph? i = Import["http://i.stack.imgur.com/Ac8m0.png"]; The caption of the picture reads: " Two-dimensional ...
psimeson's user avatar
  • 663
15 votes
2 answers
2k views

Joining points into 3D surface

This seems like a simple problem, but I can't find any questions like it here so I'm making a new one. Apologies if I missed one. I have a list of points contained in a file which can be visualized ...
Crêpo's user avatar
  • 635
15 votes
1 answer
617 views

Why does LogLinearPlot sample its argument outside the specified domain?

Bug introduced in 6.0 and fixed in 9.0.0 I experience a weird bug in the function LogLinearPlot. If the input is an interpolation function, such as the one created ...
yohbs's user avatar
  • 7,046
15 votes
1 answer
1k views

Curve fit based on minimal data

Inspired by the fantastic answers here and here, I would like to ask a questions along similar lines. I have 6 curve types that follow these rules: Type A: If point 1 is positive and point 2 is ...
martin's user avatar
  • 8,332
14 votes
3 answers
6k views

Subtracting two plots from each other after shifting one

I have the following lists representing energy spectra that need to be subtracted from each other to produce a difference spectrum. ...
W. Heisenberg's user avatar
14 votes
1 answer
1k views

Custom interpolation on unstructured grid (2D, 3D)

as I'm not satisfied with the way Mathematica interpolates data on unstructured grids, I would like to implement my own interpolation. I will aim for Crouzeix - Raviart type of (quadratic) triangular ...
user16320's user avatar
  • 2,316

1
2 3 4 5
20