# coding:utf-8
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
plt.rcParams['font.sans-serif'] = ['SimHei']
xnodes = np.array([0.193,0.111,0.088,0.072,0.059,0.037,0.024],dtype=float)
ylaw = np.array([121,115,110,105,100,80,55],dtype=float)
zaxis = np.array([2.11,1.69,1.51,1.32,1.10,0.72,0.35],dtype=float)
cos = np.array([0.36,0.53,0.62,0.70,0.75,0.97,1.06],dtype=float)
xnodes = xnodes[::-1]
ylaw = ylaw[::-1]
zaxis = zaxis[::-1]
cos = cos [::-1]
plt.figure(1)
plt.title(r'$\cos=f(U_0)$')
plt.xlabel(r'$U_0/V$')
plt.ylabel(r'$\cos\phi_0$')
xinterp3 = np.linspace(55,125,100)
yinterp3 = interpolate.UnivariateSpline(ylaw,cos)(xinterp3)
plt.plot(ylaw,cos,'or')
plt.plot(xinterp3,yinterp3,'k',linewidth=1)
plt.show()
没有像matlab这样的功能,或者别的东西。与这种情况类似,有什么更好的解决方法。