Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Jun 16, 2008 #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!



    [​IMG]

    [​IMG]
     
    Last edited: Jun 16, 2008
  2. jcsd
  3. Jun 16, 2008 #2

    matt grime

    User Avatar
    Science Advisor
    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: Jun 16, 2008
  4. Jun 16, 2008 #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.
     
  5. Jun 16, 2008 #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: Jun 16, 2008
  6. Jun 16, 2008 #5
    What exactly are you doing with matrices? This is simple Cartesian geometry.
     
  7. Jun 16, 2008 #6

    Redbelly98

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    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
     
  8. Jun 16, 2008 #7

    ehj

    User Avatar

    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
     
  9. Jun 16, 2008 #8
    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?
     
  10. Jun 17, 2008 #9

    matt grime

    User Avatar
    Science Advisor
    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.
     
  11. Jun 17, 2008 #10








    oh ok so i was wrong then, with the variables. thanks for the help.
     
  12. Jun 17, 2008 #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,
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Scalar equations, should be EASY but this has been bothering me for years
Loading...