1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Can i get a mathematical function out of this picture?

  1. Jan 18, 2017 #1
    i am working for a small project at home , and for it i am using an infra red sensor . which returns a voltage value relative to distance .
    this picture describes the output : (given by the datasheet) :

    (the picture is highly precise)

    now all of the distances that i will be getting are superior than 8cm so it's a bijective function for me . within the micro-controller , the only solution that was able to find is to make a large array of floats with segments of voltage and the corresponding distance values . i need high precision with this project so that solution would consume a massive amount of memory and would cut down from other of the project's aspects .
    is there anyway i can find a function that mimic with good precision the behavior of the evolution these values ?
    thank you .
    Last edited by a moderator: Jan 18, 2017
  2. jcsd
  3. Jan 18, 2017 #2
    Picture did not seem to come through. Can you re-attach?
  4. Jan 18, 2017 #3
    done , thank you for responding sir .
  5. Jan 18, 2017 #4


    User Avatar
    2017 Award

    Staff: Mentor

    What does "high precision" mean? The visible corners in the graph look like measurements artifacts. If you can see deviations from a smooth curve by eye, it cannot be that precise.

    You can store some values and then make linear interpolations between them.

    You can try exponential decays, 1/x, 1/x2 functions and so on, but they won't beat the accuracy of linear interpolations - if you measurements are all really accurate.
  6. Jan 18, 2017 #5
    thank you sir .
  7. Jan 18, 2017 #6


    Staff: Mentor

    Make a linear interpolation table of the graph. Where things are relatively flat (ie same slope) you can space the x,y points further apart and where things change you can select more x,y points.

    Some examples are provided in the article:

  8. Jan 18, 2017 #7

    Stephen Tashi

    User Avatar
    Science Advisor

    Do you also need flexibility? For example, will the actual curve on the device change as the component ages? Will you need to calibrate the system if you use a new type of paper?
  9. Jan 18, 2017 #8


    User Avatar
    Science Advisor

    The curve looks like [itex]xe^{-x} [/itex]...
  10. Jan 18, 2017 #9


    User Avatar
    Science Advisor
    Gold Member

    Use electronics to linearise the sensor response .
    Last edited: Jan 18, 2017
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted