# Converting voltage to celsius using Matlab or Scilab part 1

Posted on May 9, 2011

During my work on one of my main projects, I found myself required to verifie voltage measurements and  to compare it with temperature measurements of an appliance.

Over my examination  I’ve used the Agilent 34980A with temperature multiplexer. I took samples over certain period of time and preserved the information on laptop in form of ascii file. Then I redo the same process, only this time I measured voltage instead of temperature.

Now I have two ascii files that contains my sampled temperature/voltage. Using matlab or Scilab I want to convert my voltage sampled information to temperature in order to confirm that they are approximately the same.

I have 8 scanned ports, but I’ll examine every port in a separate process.

Finding mathematical behavior for voltage – temperature slope

According to the literature, we know that the slope of thermocouple response curve changes over temperature. Using the fact that my thermocouples are from type T and examined between 0 – 80 Celsius degrees the slope acts much linear. Actually, Ihave checked it myself by giong to NIST appropriate page and plotting (both Matlab and Scilab) the curve in order to see that it’s actually linear.

Using “Basic Fitting” Matlab tool, I found both the slope and the equation of this linear behavior. We will get the same result by:

polyfit(x1,cels,1)

In Scilab it was bit difficult, but thanks to WolfData’s site I managed to receive the same result using ‘regres

s’ function.

So now I know for sure that I’m in the linear region, allowing me to write a simple equation that will convert my volatge samples to a temperature value, dumping the option of typing the full table of NIST.

In the next part I will examine (using the linear equation) my voltage and temperature samples  match suitability.

NOTE: You can enlarge any of the pictures by right clicking on it and ‘open image in a new tab’ option.

Posted in: Open Source