In the output of a large computer simulation(thousands of cpus for 3 days), I found that one data point is missing in the result. Is it possible to reconstruct the missing value using the remaining data?

Assumptions: The dynamics in the data is generally smooth and there is no shape feature in it.

Here is the data:


Also from other output information, I can determined that the problem data is at the index 51, which is set to 0 in the above.

So is it possible to reconstruct that value?

Here is my try:

I use the wavelet transform to identify the abrupt changes in the data, and manually adjust the data value, until I get a relative smooth wavelet transform.

 data1 = data;
 data1[[51]] = data[[51]] + Abs[Mean[{data[[50]], data[[52]]}]]*x;
 cwd = ContinuousWaveletTransform[data1, 
   GaborWavelet[10], {Automatic, 12}];
 values = Abs[cwd[All, "Values"]];
 ListDensityPlot[values, ColorFunction -> "TemperatureMap", 
  PlotRange -> {All, {0, 50}, {0, 0.1 Max[values]}}, 
  ClippingStyle -> Automatic, InterpolationOrder -> 0]
 {x, -10, 30, 1}

enter image description here

Form above I determined by eye that when x=17 the wavelet is smoothest. So the missing data I get is 0.377765. And here is a plot of the data and the wavelet transform after the fix

enter image description here enter image description here


  1. What are the general ways of reconstruct missing data?
  2. Are there other methods to reconstruct the missing data, without looking by eye?
  • $\begingroup$ Related: Interpolating 2D data with missing values $\endgroup$
    – user484
    Nov 23, 2013 at 3:52
  • 1
    $\begingroup$ Update: I tried the approach in that question, but it doesn't work too well thanks to the rapid oscillation in the data. Only with InterpolationOrder -> 100 does it get close to the expected result, and with even higher orders it becomes unstable. $\endgroup$
    – user484
    Nov 23, 2013 at 4:00
  • $\begingroup$ Very nice idea indeed to use animation for manual determination of "the best" value! $\endgroup$ Nov 23, 2014 at 13:16

1 Answer 1


I don't think there are "general methods". Normally interpolation or curve fitting can be used.

Let's see your particular problem. You have five distinct samplings:

ListLinePlot[data[[# ;; -1 ;; 5]] & /@ Range@5]

enter image description here

The first one shows the problem:

ListLinePlot[data[[1 ;; -1 ;; 5]]]

enter image description here

Let's see which point is the outlier:

First@Ordering[-Abs@Differences@data[[1 ;; -1 ;; 5]]]

Let's calculate a "right" value

Mean[{data[[1 ;; -1 ;; 5]][[10]], data[[1 ;; -1 ;; 5]][[12]]}]

And now we replace it in the original sequence

ListLinePlot@ ReplacePart[data, Position[data, 0.][[1]] -> 0.37620699999999996`]

enter image description here


If you want a slightly better approximation, you could do something like:

pata = Transpose[{Range@Length@data, data}]; 
Interpolation[Join[pata[[1 ;; -1 ;; 5]][[5 ;; 10]], 
                   pata[[1 ;; -1 ;; 5]][[12 ;; 18]]]][51]

  • 1
    $\begingroup$ That's clever. How do you determine the number 5? What do you mean by "five distinct samplings"? $\endgroup$ Nov 23, 2013 at 0:00
  • $\begingroup$ @xslittlegrass Your sampling freq is almost five times the highest freq of the signal. You are sampling five times each period $\endgroup$ Nov 23, 2013 at 0:06

Your Answer

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

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