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

  • Context: Undergrad 
  • Thread starter Thread starter hxtasy
  • Start date Start date
  • Tags Tags
    Scalar Years
Click For Summary

Discussion Overview

The discussion revolves around the calculation of linear relationships between pressure and voltage in the context of a pressure sensor. Participants explore methods for deriving equations from given data points, the discrepancies between their calculations and those produced by Excel, and the use of matrices versus simpler algebraic methods.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes using a pressure sensor that outputs a voltage linearly related to pressure, expressing confusion about the calculation methods.
  • Another participant suggests a straightforward algebraic approach to derive the equation without using matrices, emphasizing that it can be solved by substitution.
  • Some participants question the necessity of matrices for this problem, wondering if more complex scenarios might warrant their use.
  • Discrepancies between the participant's calculations and Excel's results are noted, with one participant suggesting that Excel may use more decimal places, leading to more accurate results.
  • Another participant provides hand calculations for slope and intercept, noting small differences between their results and Excel's, attributing these to rounding errors in Excel.
  • There is a discussion about the correct interpretation of variables and the arrangement of the equations, with some participants expressing confusion over the plotting of axes.

Areas of Agreement / Disagreement

Participants express differing views on the necessity and effectiveness of using matrices versus simpler methods. There is no consensus on the best approach to take, and discrepancies in calculations remain unresolved.

Contextual Notes

Participants mention potential rounding errors and the impact of decimal precision on the accuracy of results. There is also uncertainty regarding the correct arrangement of variables in the equations.

hxtasy
Messages
112
Reaction score
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
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.
 
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
 
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
 
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?
 
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,
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
Replies
10
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K