Can i get a mathematical function out of this picture?

Click For Summary
SUMMARY

The discussion focuses on deriving a mathematical function from the output of an infrared sensor that returns voltage values relative to distance. The user seeks a high-precision solution without consuming excessive memory, as creating a large array of floats for voltage-distance pairs is impractical. Suggestions include using linear interpolation for accuracy and exploring functions like exponential decays and inverse functions, although linear interpolation is recommended for maintaining precision. The conversation also touches on the need for flexibility in the model due to potential changes in sensor response over time.

PREREQUISITES
  • Understanding of infrared sensor output and voltage-distance relationships
  • Knowledge of linear interpolation techniques
  • Familiarity with mathematical functions such as exponential decay and inverse functions
  • Basic principles of microcontroller memory management
NEXT STEPS
  • Research "linear interpolation techniques for sensor data" to implement efficient data handling
  • Explore "exponential decay functions in sensor calibration" for potential modeling
  • Study "1/x and 1/x² functions" to evaluate their applicability in sensor output modeling
  • Investigate "microcontroller memory optimization strategies" to enhance project performance
USEFUL FOR

Electronics hobbyists, embedded systems developers, and anyone involved in sensor data processing and optimization for high-precision applications.

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   Reactions: 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   Reactions: 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:

Similar threads

Replies
2
Views
748
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 10 ·
Replies
10
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K