Can i get a mathematical function out of this picture?

Bayoudh101
Messages
12
Reaction score
0
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) :

pnGRf0u.png

(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:
Mathematics news on Phys.org
Picture did not seem to come through. Can you re-attach?
 
  • Like
Likes Bayoudh101
dkotschessaa said:
Picture did not seem to come through. Can you re-attach?
done , thank you for responding sir .
 
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.
 
  • Like
Likes Bayoudh101
thank you sir .
 
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:

https://en.wikipedia.org/wiki/Interpolation
 
Bayoudh101 said:
i need high precision with this project

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?
 
The curve looks like xe^{-x}...
 
Use electronics to linearise the sensor response .
 
Last edited:
Back
Top