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

In summary, the conversation discusses a method for calculating values between two known points using a slope line equation. The method can be done without using matrices and involves solving for the unknowns by substitution. The conversation also addresses discrepancies between the equations produced by the method and those produced by Excel. The conversation concludes with a question about the use of matrices in this type of problem.
  • #1
hxtasy
112
1
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!



ScalarEquationWTF.jpg


ScalarEquationWTF.jpg
 
Last edited:
Mathematics news on Phys.org
  • #2
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:
  • #3
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.
 
  • #4
And why do you think that excel's equation is different? edit: i guess excel used more decimal places than i did.
 
Last edited:
  • #5
What exactly are you doing with matrices? This is simple Cartesian geometry.
 
  • #6
hxtasy said:
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
 
  • #7
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
 
  • #8
ehj said:
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?
 
  • #9
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.
 
  • #10
matt grime said:
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.
 
  • #11
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,
 

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

What is a scalar equation?

A scalar equation is a mathematical expression that contains only scalars, which are quantities that have magnitude but no direction. This means that the variables in a scalar equation are real numbers and do not have any directional components.

How do I solve a scalar equation?

To solve a scalar equation, you need to isolate the variable on one side of the equation by using algebraic operations such as addition, subtraction, multiplication, and division. Once the variable is isolated, you can solve for its value by performing the same operations on both sides of the equation until the variable is left alone on one side.

What is the difference between a scalar equation and a vector equation?

A scalar equation deals with quantities that have only magnitude, while a vector equation deals with quantities that have both magnitude and direction. This means that the variables in a vector equation can be represented by vectors, which have both a magnitude and a direction.

Can a scalar equation have more than one solution?

Yes, a scalar equation can have infinitely many solutions. This is because the equation can be true for any value of the variable that satisfies the equation. However, some scalar equations may have no solution or only one unique solution, depending on the specific equation and its constraints.

How are scalar equations used in real life?

Scalar equations have many practical applications in various fields such as physics, engineering, and economics. They can be used to describe and solve problems related to motion, forces, electricity, and more. In everyday life, scalar equations are used to calculate distances, speed, and other quantities that do not have a directional component.

Back
Top