June 2015
Beginner
348 pages
8h 44m
English
We will create data points using a
sinc() function and add some random noise to it. After this, we will do a linear and cubic interpolation and plot the results.
x = np.linspace(-18, 18, 36) noise = 0.1 * np.random.random(len(x)) signal = np.sinc(x) + noise
interpreted = interpolate.interp1d(x, signal) x2 = np.linspace(-18, 18, 180) y = interpreted(x2)
cubic = interpolate.interp1d(x, signal, kind="cubic") y2 = cubic(x2)
matplotlib:plt.plot(x, signal, 'o', label="data") ...
Read now
Unlock full access