3
$\begingroup$

I have a set of data, e.g. damped waves in a finite box of size L, so that the data is periodic in space but not time. At a particular instant in time, i.e. taking a cross section of data at a particular time, which I'll call dataSlice, I can create an interpolating function

intFn = Interpolation[dataSlice, InterpolationOrder -> 1, PeriodicInterpolation -> True]

and I don't run into trouble. However, if I attempt a periodic interpolation on the whole data set, it fails

intFn = Interpolation[dataSlice, InterpolationOrder -> 1, PeriodicInterpolation -> True]

(*In dimension 1 the data at the endpoints of the fundamental period are not equal*)

That makes sense, of course. For my data, it would make sense to do a semi-periodic interpolation. Does such a function exist? I would like it to function like

intFn = Interpolation[dataSlice, InterpolationOrder -> 1, PeriodicInterpolation -> {False,True,True,True}]

so the first (time) dimension would be non-periodic, and the spatial dimension is periodic.

$\endgroup$
2
  • $\begingroup$ You could create a new function out of the interpolation function that applies modulus to the function arguments. $\endgroup$
    – C. E.
    Jul 1, 2020 at 4:41
  • $\begingroup$ Please provide a minimal working example! $\endgroup$ Jul 1, 2020 at 10:43

1 Answer 1

4
$\begingroup$

If the data are equidistant in the two dimensions and if the InterpolationOrder is 1, BSplineFunction can be used equivalently.
The advantage is that BSplineFunctionis able to manage partially periodic domain.

n = 10;
dataSlice = N[Sin /@ Range[0, 2 Pi (1 - 1/n), 2 Pi/n] ]
data = Table[Exp[-2 i]  dataSlice, {i, 0.2, 1, 0.1}];
f = BSplineFunction[data, 2, SplineDegree -> 1, 
  SplineClosed -> {False, True}]
Plot3D[f[t, x], {x, 0, 2}, {t, 0, 2}]  

enter image description here

The domain of the basic pattern is [0,1]X[0,1] and the samples are equidistant in both dimensions of this domain.

I don't know if it works for Interpolation order >1 (I would guess : No).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.