Solución: R T β T R (T) = 1000 Ω Ω
Solución: R T β T R (T) = 1000 Ω Ω
16
Linear approximation of nonlinear transfer function. The response of a temperature sensor is given as
where R0 is the resistance of the sensor at temperature T0 and β is a constant that depends on the material of
the sensor. T0 = 20°C. Temperatures T and T_{0} are in K. Given: R(T ) = 1000 Ω at 25°C and 3000 Ω W at
0°C. The sensor is intended for use between -45°C and 120°C.
1 1
β( − )
R(T ) = R 0 e T T
0
a.Evaluate β for this sensor and plot the sensor transfer function for the intended span.
b. Approximate the transfer function as a straight line connecting the end points and calculate the maximum error
expected as a percentage of full scale.
c. Approximate the transfer function as a linear least squares approximation and calculate the maximum error
expected as a percentage of full scale.
Solución
a. Evaluate β for this sensor and plot the sensor transfer function for the intended span. From the two known
points
R 1 = 3000 Ω , T1 = 273.15 K .
R 2 = 1000 Ω , T2 = 298.15 K .
we obtain
R2
ln( )
R1
β = .
1 1
( − )
T2 T1
file:///C:/Users/Manuel%20Ranchoddas/Downloads/Ejercicio+2.16.html 1/6
29/8/2017 Ejercicio 2.16
## Results
print ('Beta for this sensor = %2.2f and the resistance of the sensor at tempe
rature T0 is R_0 = = %2.2f' % (beta, R_0))
# Plot
# plt.plot(T,R_T,T[45],R_T[45],'ro',T[45+25],R_T[45+25],'ro')
plt.plot(T,R_T)
plt.ylabel('Resistance of the sensor[ohm]')
plt.xlabel('Temperature [K]')
plt.show()
Beta for this sensor = 3578.82 and the resistance of the sensor at temperatur
e T0 is R_0 = = 1227.20
The plot shows the nonlinear behaviour of the sensor and the two points used for estimating the curve. b.
Approximate the transfer function as a straight line connecting the end points and calculate the maximum error
expected as a percentage of full scale.
We approximate the transfer function as a straight line as R(T ) linear = aT + b and compute the error.
file:///C:/Users/Manuel%20Ranchoddas/Downloads/Ejercicio+2.16.html 2/6
29/8/2017 Ejercicio 2.16
# Linear approximation
R_T_linear = a*T+b
# Plot
plt.plot(T,R_T_linear,'b:',label='Linear approximation')
plt.plot(T,R_T,label='Transfer function')
plt.ylabel('Resistance of the sensor[ohm]')
plt.xlabel('Temperature [K]')
plt.legend(loc='upper right')
plt.show()
file:///C:/Users/Manuel%20Ranchoddas/Downloads/Ejercicio+2.16.html 3/6
29/8/2017 Ejercicio 2.16
error=np.abs(R_T-R_T_linear)/FS*100;
# error_X=np.abs(error_Y/a2);
plt.ylabel('error [%]')
plt.plot(T,error)
plt.xlabel('Temperature [K]')
plt.show()
print ('The maximum error expected as a percentage of full scale is = %2.2f
%%' % (np.max(error)))
Note how the error starts from zero reaches a maximum of 66.5 % and comes back down to zero at the other
end point as expected.
c. Approximate the transfer function as a linear least squares approximation and calculate the maximum error
expected as a percentage of full scale.
Mediante la funcion polyfit se realizo la aproximacion lineal de la funcion de transferencia del sensor. El maximo
error con respecto a la temperatura es calculado a partir de la diferencia entre R(T) y la aproximacion obtenida,
en el intervalo definido por los puntos de corte de la funciones. Esta diferencia dividida por la pendiente de la
aproximacion me dará el error en el eje correspondiente a la temperatura en K:
file:///C:/Users/Manuel%20Ranchoddas/Downloads/Ejercicio+2.16.html 4/6
29/8/2017 Ejercicio 2.16
# Linear approximation
R_T_lsq = a*T+b
# Plot
plt.plot(T,R_T_lsq,'b:',label='Least Squares fit')
plt.plot(T,R_T,label='Transfer function')
plt.ylabel('Resistance of sensor [ohm]')
plt.xlabel('Temperature [K]')
plt.legend(loc='upper right')
plt.show()
file:///C:/Users/Manuel%20Ranchoddas/Downloads/Ejercicio+2.16.html 5/6
29/8/2017 Ejercicio 2.16
In [11]: error=np.abs(R_T-R_T_lsq)/FS*100;
# error_X=np.abs(error_Y/a2);
plt.ylabel('error [%]')
plt.plot(T,error)
plt.xlabel('Temperature [K]')
plt.show()
print ('The maximum error expected as a percentage of full scale is = %2.1f
%%' % (np.max(error)))
In [ ]:
file:///C:/Users/Manuel%20Ranchoddas/Downloads/Ejercicio+2.16.html 6/6