■Description
Performs linear interpolation of array data.
■Example <Case1>
For 1-dimensional array
import numpy as np
from scipy import signal, interpolate
x = np.array([1,2,5]) # X-axis
y = np.array([10,1,5]) # Y-axis
func = interpolate.interp1d(x,y) # Definition of linear interpolation function
a = np.array([1.5,4]) # Input
print(func(a)) # Output
#[5.5 3.66666667]
<Case2>
For 2-dimensional array
x = np.array([1,3,5]) # X-axis
y = np.array([10,20,30]) # Y-axis
z = np.array([[1,2,3],[4,5,6],[7,8,9]]) # Z-axis
func = interpolate.interp2d(x,y,z) # Definition of linear interpolation function
a = 4 # Input value for X-axis
b = 15 # Input value for Y-axis