- #1
BOAS
- 553
- 19
Hello,
I am trying to determine the thermal conductivity of a material based on the following information.
##Q_x = - k \frac{dT}{dx}##
Temperature as a function of ##x, T(x)##;
##T(0) = 15##
##T(0.1) = 10##
##T(0.2) = 5##
##T(0.3) = 3##
and finally that ##Q_{x=0} = 40 \mathrm{Wm^{-2}}##
The way I am approaching this problem is to use a spline to interpolate the data, and then find the derivatives of this function. My problem is that I can't figure out how to evaluate the derivative at a given point.
For example, how do I evaluate the derivative at x = 0?
I am trying to determine the thermal conductivity of a material based on the following information.
##Q_x = - k \frac{dT}{dx}##
Temperature as a function of ##x, T(x)##;
##T(0) = 15##
##T(0.1) = 10##
##T(0.2) = 5##
##T(0.3) = 3##
and finally that ##Q_{x=0} = 40 \mathrm{Wm^{-2}}##
The way I am approaching this problem is to use a spline to interpolate the data, and then find the derivatives of this function. My problem is that I can't figure out how to evaluate the derivative at a given point.
For example, how do I evaluate the derivative at x = 0?
Python:
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import splev, splrep
x = np.array([0, 0.1, 0.2, 0.3],dtype=float)
T = np.array([15, 10, 5, 3],dtype=float)
xnew = np.linspace(0,0.3,100)
f = splrep(x,T,s=0)
ynew = splev(xnew,f,der=0)
yder = splev(xnew,f,der=1)
plt.grid(True)
plt.plot(x,T,'x',xnew,ynew,xnew,yder)
plt.show()
plt.close()
Last edited: