# Homework Help: Ideal Straight Line - instrumentation HND

1. Mar 20, 2016

### cps.13

1. The problem statement, all variables and given/known data
I am doing a distance HND and need to find the ideal straight line of a sensor output. The sensor is a temperature sensor with an OHM output. From a temperature range of 0-250 it has an output of 120-364ohm.

temp output
0 = 120
50 = 178
100 = 201
150 = 249
200 = 303
250 = 364

I need to generate the ideal straight line equation.

3. The attempt at a solution

I have plotted a line of the points on a graph with the x axis as ohms and the y axis as temperature. Calculated the line of best fit using y = mx+C where...

m = (249-201)/(150-100)= 0.96
Using the data for a temp of 150 c = 249 - (150*.96) = 105
therefore the equation of the line is

y = 0.96x + 105

When I now calculate the ideal ohm output values they seem quite wayward of the values given.

temp ISL Temp
0 = 105
50 = 153
100 = 201
150 = 249
200 = 297
250 = 345

can anyone see if I have made a mistake? should I be calculating my line equation by using the entire temperature range from 0-250?

thanks

2. Mar 20, 2016

### Ray Vickson

3. Mar 20, 2016

### Staff: Mentor

HND = ??
ISL = ??

Please expand these acronyms so we can know what you're talking about.

4. Mar 20, 2016

### cps.13

ISL = ideal straight line as mentioned earlier in the post
HND = Higher National Diploma.

5. Mar 20, 2016

### Ray Vickson

Since you seemed to have ignored my previous response, I will expand on it a bit. First: YES, you should try to use the entire (x,y) data set, unless you have reason to suspect that some data points are seriously wrong. A simple plot in your case does not suggest any of the points to be truly anomalous, so none of them should be dropped.

A standard method for such problem is the so-called "least-squares" fitting method, where you want to minimize the total of all the squared errors in the fit. That is, in your case you have six data points, so in general there will be six "residual errors"; these are the amounts by which the y-values of the data points miss the straight line. You want some "goodness of fit" measure involving all six of the errors; furthermore, you should look at a measure that involves the absolute errors, not the actual numerical values of the errors. By this, I mean that if one residual error = (actual y) - (fitted y-value) is, for example equal to -2, you should count that as a +2, because +2 is the actual distance between the fit and the data. Positive error means the actual y lies above the fitted value, while negative error means the actual y lies below the fit. You can have positive and negative errors cancelling in total, but that does not mean the fit is perfect; there could still be a significant difference between the data and the fit. When we look, instead, at absolute errors |actual y - fitted y| we eliminate that problem, so guard against false confidence. Looking at squared errors (actual-fit)^2 also gets around the problem of false error-cancellation, and furthermore has the additional desirable property that small errors are de-emphasized, while large errors have their importance magnified. Besides, the least-squares method has been in use for over 200 years, and involves only elementary methods.

Every spreadsheet comes equipped with a least-squares fitting module, and there are also on-line sources that will do the calculations for you. Many hand-held calculators also have a "least-squares fit" button. However, the calculations are so straightforward that no fancy tools are needed, and just using the calculator for addition and multiplication is enough.