学而时习之。弄个小应用,先构造一个随温度变化的热电偶,然后通过测量热电偶的电压,反推温度。
一、构造一个热电偶,其电阻随温度线性变化:
% input the temperature
temp_zoom=25 ; % normal temperature in clesius
abs_zero_temp=-273 ; %abselutely temperature in kailvin(K)
res0=500 ; %ohm
vref=1 ;% ref voltage unit V
keff1=0.001 ;% unit is V/K
keff2=0.0000004; %unit is V/K^2
temp=-40:1:125 ; % in clesius
length=size(temp,2);
for ii=1:length
tempk(ii)=temp(ii)-temp_zoom; % temp shift
res_temp=res0*( 1 + tempk(ii)*keff1 + tempk(ii)*tempk(ii)*keff2);
vtest(ii)=vref*res_temp/(res_temp+res0); % the voltage of the thermal res
end
plot(temp,vtest,'r+');
grid on ;
ylabel('thermal voltage unit=V')
xlabel('temperature unit=C')
title('the thermal voltage of the resisitor')