import os
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate
os.chdir(r'D:\projects\wordpress\ex57')
os.getcwd()
x=np.linspace(0,15,10)
xn=np.linspace(0,15,50)
y=np.sin(x) + 0.2*x
interp=scipy.interpolate.InterpolatedUnivariateSpline(x,y)
plt.plot(x,y,'o',xn,interp(xn))
plt.xlabel('x')
plt.ylabel('y')
plt.legend(["$y(x)$", "$s(x)$"],loc='best')
plt.tight_layout()
plt.savefig("example57.png", dpi=100)
plt.show()
plt.close()

example57
 

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading