Experiments
With Temperature Sensors - Data Analysis Using Matlab
In the first part of this project, you gathered time response data for
three temperature sensors. In this part of the project, you will
analyze the data you gathered and determine the time constant(s) of these
sensors. First, be sure you have done the following.
-
Read the note
on time constants. That note shows several different ways of
computing the time constant of a system from data taken on the system.
Then, using the three
methods outlined in the note, compute values for the time constants, and
compare results for the different methods. You can use Matlab to
get the time constant for your data using the analysis method.
Here is what you need to do.
-
You need six (6) sets
of data from the previous lab. Those
data sets are:
-
Rising and falling temperature
for the thermistor. Temperature vs Time.
-
Rising and falling temperature
for the thermocouple. Temperature vs Time.
-
Rising and falling temperature
for the LM35. Temperature vs Time.
-
You should determine rising
and falling time constants for each sensor and determine whether they are
the same (rising and falling) for each sensor.
-
Your goal is to determine
the time constant(s) of the different sensors.
-
Click
here for the summary lesson on time constants.
-
There are three different
methods you can use to calculate the time constants. They are detailed
in the summary lesson on time constants. Those methods are:
The first two methods above are relatively simple to apply. The third
method requires some computation that can be done in an analysis program
like Mathcad, Matlab or a spreadsheet. Here is the text of a Matlab
m-file that will do the computations.
load tempdata.txt
-ASCII
time = tempdata(:,1)
temp = tempdata(:,2)
plot(time,temp)
Tss = 68.5
deltemp = Tss - temp
logdeltemp = log(deltemp)
plot(time,logdeltemp)
c = polyfit(time,logdeltemp,1)
Tau = -1/c(1)
TStart = exp(c(2))
This workspace does the
following operations.
-
It loads data into Matlab
from a text file (flat file).
That data is loaded into a two-dimensional array with the same name as
the text file.
-
After loading the data,
it is stripped into two linear arrays for time and temperature.
-
Those two arrays are plotted.
(And, it may be a good idea to put the code to this point in a separate
m-file so you can see the plot of temperature vs time, and save it if you
want to.)
-
Then, a steady-state temperature
is assumed (from looking at the data prior to loading it), and a variable
- deltemp - is formed. Deltemp should decay to zero on your plot.
If deltemp does not decay to zero, you need to adjust the value of the
steady-state temperature.
-
After calculating the
plotting the logarithm of deltemp, the best-fit line is determined using
a Matlab function, polyfit. Polyfit returns two numbers, the slope
- in the first element - and the intercept in the second element.
Those can be converted to the time constant and the starting value of the
temperature. See the summary
lesson on time constants.
When you have calculated
the time constant for each case summarize your methods in a report (using
tables to present your results) and compare your values using the different
methods and note whether the devices have consistent time constants for
rising and falling transients.