# Scalar equations, should be EASY but this has been bothering me for years

Ok this is a pretty simple concept and in the electronics field I use it on a monthly basis, I can do it but I do not understand how it works and It is bugging the crap out of me.

EXAMPLE: I have a pressure sensor, it reads pressure from 0 psi to .73 psi, and outputs a corresponding voltage from 2.996 volts to 5 volts, completely linear. If I know the min and max of the pressure in and the minimum and maximum units of the voltage out, I can calculate the all the points in between with a slope line equation.

Now when I do this I usually just use the my calculator [TI-86] and use simult, because it is easier IMO than using matrices, but mathematically the same.

Below is a picture of how I set it up in my calculator, and then me plotting the points in excel and having excel compute the linear equation. I have three questions:

1.) Every time I do these equations I do something different or i fail a dozen times before succeeding. What is the correct way to set this up, or what is a consistent way I can set it up?

2.)Why is excel's equation and mine different? The scaling factor differs by almost ten percent and the offset differs by 15 percent. This is not acceptable, but the problem is, in "real life" when I feed values to the pressure sensor, from random points in between min and max, the excel equation is more accurate then my equation. I would think Mine would be more accurate as I didn't round any decimal places.

3.) How would you do the matrix by hand? Would it be the same as doing a wronskian? I hate relying on the calculator.

Thanks guys. I think I posted this question in the past but I wasn't as specific and therefore didn't get a satisfying answer. Help Appreciated!  Last edited:

matt grime
Homework Helper
You mean saying - if P is pressure and V voltage - that

V=aP+b

and by using the two extremes (0 and 0.73) you get two equations in two unknowns for a and b. Well, there's no need to invoke matrices: just solve by substitution. Although in this case it is obvious that b=2.996 (from P=0). Then a is (5-2.996)/0.73 from the other known example. See: no matrices, just plugging things in. In fact invoking matrix methods disguises that this can be done by straight forward manipulation.

Last edited:
Oh ok I get it now. IDK why we were always taught to use matrices, and I seen someone once do an equation like this very fast in their head using a simple method like this and i was like how in the...

Is there maybe a form of these equations that can be more complicated that would make it beneficial to use matrices?

Sometimes they are confusing when you have a positive slope line corresponding to a negative sloped line.

And why do you think that excel's equation is different? edit: i guess excel used more decimal places than i did.

Last edited:
What exactly are you doing with matrices? This is simple Cartesian geometry.

Redbelly98
Staff Emeritus
Homework Helper
And why do you think that excel's equation is different? edit: i guess excel used more decimal places than i did.

I don't know why, and can only say that the Excel equation is correct. It gives the correct pressure values at 2.996V and 5V (to 3 or 4 places past the decimal). Your expression incorrectly gives 0.084 at 2.996V, and 0.752 at 5V, so there is a problem either with your method (which I didn't understand) or the way you implement the method.

Regards,

Mark

I don't know much about matrices, but it looks like you include the point (1,1) in it? Or maybe that means something else than a point =P

I don't know much about matrices, but it looks like you include the point (1,1) in it? Or maybe that means something else than a point =P

the 1's i put represent the gain, I really don't know why that's one question I had; I think it has something to do with the slope being positive or negative or which equation you are solving for. We use this equation a lot when we do scaling for operation amplifiers, in fact a lot of people use this method. but i also use it for problems like this because it's a similar concept.

Matt:
"You mean saying - if P is pressure and V voltage - that

V=aP+b

and by using the two extremes (0 and 0.73) you get two equations in two unknowns for a and b. Well, there's no need to invoke matrices: just solve by substitution. Although in this case it is obvious that b=2.996 (from P=0). Then a is (5-2.996)/0.73 from the other known example. See: no matrices, just plugging things in. In fact invoking matrix methods disguises that this can be done by straight forward manipulation."

I'm not understanding something here.

V = aP + B

plug in one parameter:

3 = x(0) + B [rounding to 3]

B= 3

substitute in next equation:

V= aP + 3

use second parameter:

5 = a(0.73) + 3

a = 2/.73

So now you have:

V = 2.73P + 3 ??????

but that is not what i'm looking for. Am I doing this wrong? Maybe I use the matrices because I suck at math?

matt grime
Homework Helper
Why is it not what you're looking for? It is exactly what you asked for. The difference is that in your graphic you've plotted P on the vertical (y) axis, and V on the x axis, so the equation you've got is from solving P=uV+w, which can be gotten by simple rearrangement of the equation you worked out above.

Why is it not what you're looking for? It is exactly what you asked for. The difference is that in your graphic you've plotted P on the vertical (y) axis, and V on the x axis, so the equation you've got is from solving P=uV+w, which can be gotten by simple rearrangement of the equation you worked out above.

oh ok so i was wrong then, with the variables. thanks for the help.

ok given your data I did the following hand calculations:

first calculate slope:

m = delta Y / delta X

m = (y2 - y1 ) / (x2 -x1 )

m = ( 0.73 - 0 ) / (5 - 2.99 )

m = 0.73/2.01 = 0.3631

Calculate C:

y - mx = c

(pick x2,y2)=

0.73 - (5 * 0.3631) = -1.0859

thus:

Excels m and c:

y = 0.3643x - 1.0914

Handcalcs m and c:

y = 0.3631x - 1.0859

difference: m = +/- 0.0012 ; c = +/- 0.0055

error:

m : 0.3%
c : 0.5%

Hardley a massive error, and due to Microsofts use of Float Point Errors in Excels API, this is a known bug/issue of tiny rounding errors.

Anhar,