Question:
How do I calculate temperature trend over the short term?
fortyfiveandahalfquestions
2007-12-26 14:22:16 UTC
I get a new temperature reading every couple of seconds from a temperature sensor, How do I calculate the trend in degree's per minute? ie +0.9 degree/minute or -1.4 degree/minute

What else could be calculated from this data? ie a timestamp and temperature value?
Three answers:
Ted
2007-12-26 15:06:15 UTC
Each datapoint is a (timestamp,temperature) pair. It sounds like you are assuming that temperature should rise linearly, and you want to estimate the slope (i.e., temperature change divided by time change) of the line.



So, you need to do a linear regression analysis of your data. See the source below for information about linear regression.



Several popular programs (e.g., MATLAB, Microsoft Excel, SPSS, SAS, etc.) can perform the analysis for you. For example, in Microsoft Excel you can have it calculate a "trend line" of your data. This "trend line" represents the result of linear regression analysis.



If you would like to do the calculation yourself, see the "Polynomial fitting" section. In your case, the X matrix has two columns and the alpha vector has two rows. Each point of the y vector has a temperature and the x element of the corresponding row of the X matrix is the timestamp. Solving the equation gives you two parameters, alpha_0 and alpha_1, which represent the temperature intercept and temperature slope of your trend line. You care about the temperature slope.
devilsadvocate1728
2007-12-26 22:58:57 UTC
Your best way is to fit your data to a model. If the temperature is changing linearly, this is typically done with a linear regression that calculates the line that minimizes the squares of the deviations between the actual data and the line predicted by the model.



Or, if you want a quick and dirty way to get such a fit, you can plot your data and then draw what looks like the line of best fit through it.



More typical is to assume an exponential model in which the rate of change of temperature will be proportional to the difference between the temperature of the sample and the ambient temperature. If this is done with precision, you can determine the starting temperature of the sample, the temperature at which it will finally settle, and the constant of proportionality that determines the rate at which the sample approaches the final temperature. This, however, is more difficult because such a fit would be nonlinear.
anonymous
2007-12-26 22:56:24 UTC
One simple way you could do this is to record all the different temperatures that you see within the span of a minute, then find the difference between the highest and lowest of these values. Half of this would give you some idea of an error range.



By the way, "i.e." (that is) doesn't mean the same thing as "e.g." (for example).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...