5%   Equation for Carbon Ceramic Temperature Given Resistance
%   Brian Mastracci
%
%   temati equation requires seven coefficients. Carbon ceramic sensors
%   packaged with three data points. Determine the three dominating
%   coefficients and corresponding exponents and check the accuracy of
%   the abbreviated equation against temati calibration curve for special
%   calibrated carbon ceramic sensor.
%
%   Resistance portion of data supplied by temati. User input.
R1 = input('Resistance at 4.2K: ');
R2 = input('Resistance at 77.4K: ');
R3 = input('Resistance at 293.15K: '); 
%   Temperature portion of data supplied by temati. Same for all sensors.
T1 = 4.2;
T2 = 77.4;
T3 = 294.15;
%   3x1 matrix containing temperature values.
T = [T1; T2; T3];
%   Build 3x3 matrix containing the independent variable.
R = [(1000/R1)^2 (1000/R1)^4 (1000/R1)^5;
     (1000/R2)^2 (1000/R2)^4 (1000/R2)^5;
     (1000/R3)^2 (1000/R3)^4 (1000/R3)^5];
%   Solve linear system T = R*K for 3x1 matrix K containing coefficients.
K = linsolve(R,T);
%   Display the best abbreviated equation.
fprintf('\n\nEquation: (%.6f*(1000/R)^2 + (%.6f)*(1000/R)^4 + (%.6f)*(1000/R)^5\n\n\n\n', K(1), K(2), K(3))
K(1)
K(2)
K(3)