from numpy import linspace,exp
from numpy.random import randn
from scipy.interpolate import UnivariateSpline
import matplotlib.pyplot as plt
x=linspace(-3,3,100)
y=exp(-x **2)+randn(100)/10
s=UnivariateSpline(x, y, s=1)
xs=linspace(-3,3,1000)
ys=s(xs)
plt.plot(x, y)
plt.plot(xs, ys)
plt.show()
'CAE > Enjoy Programming' 카테고리의 다른 글
#Python #class에서 #self의 사용법 (0) | 2016.03.26 |
---|---|
Solve matrix equation Ax=b (0) | 2012.03.12 |
Notes on Python variable scope (0) | 2012.01.02 |
How to use *args and **kwargs in Python (0) | 2012.01.02 |
Multiple Nonlinear Equations using the Newton-Raphson Method (0) | 2011.11.25 |