Note that there are some explanatory texts on larger screens.

plurals
  1. POInterpolate a discontinuous function with Scipy
    primarykey
    data
    text
    <p>I am having problems interpolating some data points using Scipy. I guess that it might depend on the fact that the function I'm trying to interpolate is discontinuous at x roughly 4.</p> <p>Here is the code I'm using to interpolate:</p> <pre><code> from scipy import * y_interpolated = interp1d(x,y,buonds_error=False,fill_value=0.,kind='cubic') new_x_array = arange(min(x),max(x),0.05) plot(new_x_array,x_interpolated(new_x_array),'r-') </code></pre> <p>The error I get is</p> <pre><code> File "&lt;stdin&gt;", line 2, in &lt;module&gt; File "/Library/Frameworks/EPD64.framework/Versions/7.1/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 357, in __call__ out_of_bounds = self._check_bounds(x_new) File "/Library/Frameworks/EPD64.framework/Versions/7.1/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 415, in _check_bounds raise ValueError("A value in x_new is above the interpolation " ValueError: A value in x_new is above the interpolation range. </code></pre> <p>These are my data points:</p> <pre><code> 1.56916432074 -27.9998263169 1.76773750527 -27.6198430485 1.98360238449 -27.2397962268 2.25133982943 -26.8596491107 2.49319293195 -26.5518194791 2.77823462692 -26.1896935372 3.07201297519 -25.9540514619 3.46090507092 -25.7362456112 3.65968688527 -25.6453922172 3.84116464506 -25.53652509 3.97070419447 -25.3374215879 4.03087127145 -24.8493356465 4.08217147954 -24.0540196233 4.12470899596 -23.0960856364 4.17612639206 -22.4634289328 4.19318305992 -22.1380894034 4.2708234589 -21.902951035 4.3745696768 -21.9027079759 4.52158254627 -21.9565591238 4.65985875536 -21.8839570732 4.80666329863 -21.6486676004 4.91026629192 -21.4496126386 5.05709528961 -21.2685401725 5.29054655428 -21.2860476871 5.54129211534 -21.3215908912 5.73174988353 -21.6645019816 6.06035782465 -21.772138994 6.30243916407 -21.7715483093 6.59656410998 -22.0238656166 6.86481948673 -22.3665921479 7.01182409559 -22.4385289076 7.17609125906 -22.4200564296 7.37494987052 -22.4376476472 7.60844044988 -22.5093814451 7.79869207061 -22.5812017094 8.00616642549 -22.5445612485 8.17903446593 -22.4899243886 8.29141325457 -22.4715846981 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload