Here’s the situation: For temperatures less than 0 °C an industrial platinum resistance thermometer can be characterized as follows:
AT[sup]4[/sup] + BT[sup]3[/sup] + CT[sup]2[/sup] + DT + E = R
Where T is the temperature (°C) and R is the resistance (ohms). A, B, C, D, and E are known coefficients.
This equation is (obviously) wonderful for computing R if you already know T. But it’s useless when you measure R and try to compute T (which is what we do).
Up until now I have relied on Excel’s “solver” tool, but I find it annoying and risky because the user has to manually invoke it. I would really like to derive an inverse equation so Excel can do it “on the fly.”
There’s good news, bad news, and bad news. The good news is that there does, indeed, exist an analytic solution to a general quartic (but you’d be out of luck if it were a quintic). The bad news is that that general solution is about fifty pages long, and I’m not even going to try to invert it here. And the bad news is that a general quartic has four solutions, and no matter what method you use, you’re not certain of getting the right one.
Were I in your shoes, I would just construct a big table or graph of R as a function of T, and then look at it sideways.
What are the values for the coefficients and what is the temperature range? I suspect that will limit the solutions down considerably. Would it be possible to create a series solution, such as a Taylor series, that would get reasonably close enough?
Imagine T®=sum with i from 0 to n of a(i)*R**i
with a(i) being your made up (fitted?) inverse-o-matic coefficients
If you have a differentiable function f(x), Newton’s method allows you to create a sequence converging to a solution of f(x)=0.
First, make a “guess” as to what the solution is. Plug this value into
x - (f(x)/f’(x))
(f’(x)=the derivative of f(x)). This your second guess. Plug this into the above formula to get your third guess. Plug that value in to get your fourth guess. And so on.
Some bizarre things can happen with Newton’s method, but generally it converges fairly quickly to the value you’re looking for. If you’re not comfortable with calculus, I’m sure we can help you with the details to get it set up.
Hmm…Newton’s method can do strange things, but it should handle a low-order polynomial pretty well. I assume you know basic differential calculus, Crafter_Man, but just in case, the derivative of At[sup]4[/sup] + Bt[sup]3[/sup] + Ct[sup]2[/sup] + Dt + E is 4At[sup]3[/sup] + 3Bt[sup]2[/sup] + 2Ct + D.
Hey Crafter_Man, I have some numerical root-finding routines in some of my code. It should be relatively easy for me to modify them to solve your equation and tack on a simple console interface.
I guess you wouldn’t be able to call it from excell (unless somebody else here knows how that’s done), but if you are interested let me know and email me a couple of test solutions for comparisons.
I have Newton’s method routines from Numerical Recipes as well as a Muller’s method which has some liberal borrowing from some algorithms I found on the net.
What are the values for the coefficients and what is the temperature range?
I’d be interested to know too. For instance, knowing which terms dominate, you might be able to speed things up with a hybrid method: a first pass to get a good approximation using available functions within Excel, then a couple of Newton’s iterations to refine it.
The thermocouple has been calibrated a 5 points, and a 4th order polynomial has been fitted.
There’s a few things you can do:
Test a lower order polynomial over the temperature range you’re interested in. If that gives acceptable errors, use the lower order approximation.
Populate a table with values from the 4th order polynomial (as Chronos suggested), then use linear, quadratic or cubic spline interpolation to look up the value you need.
If (1) doesn’t work, and you don’t want to use (2), then break the operating range up into smaller segments where several different lower order approximations give acceptable results.