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

• Bayoudh101
In summary, the conversation discusses using an infra red sensor for a small project and the difficulty of finding a function that accurately represents the voltage-distance relationship. The speaker mentions using a large array of floats, but this would consume a lot of memory. They also mention the possibility of using linear interpolation and exponential decay functions. The conversation ends with a question about the need for precision and flexibility in the project.
Bayoudh101
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:
Picture did not seem to come through. Can you re-attach?

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.

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:

## 1. Can a mathematical function be obtained from any picture?

No, not all pictures can be described by a mathematical function. Some images may be too complex or abstract to be represented by a function.

## 2. How do you determine if a picture can be described by a mathematical function?

To determine if a picture can be described by a mathematical function, the image must have a clear and consistent pattern or structure that can be represented by a set of mathematical equations.

## 3. What are the benefits of obtaining a mathematical function from a picture?

Obtaining a mathematical function from a picture can allow for better understanding and analysis of the image. It can also be useful for creating computer algorithms to manipulate or recreate the image.

## 4. What methods are used to obtain a mathematical function from a picture?

There are various methods that can be used, such as Fourier transforms, curve fitting, and machine learning algorithms. The method used will depend on the complexity and type of image.

## 5. Can a mathematical function accurately represent all aspects of a picture?

No, a mathematical function may not be able to accurately represent all aspects of a picture. Some features of an image, such as color and texture, may be difficult to capture with a function and may require additional techniques or algorithms.

Replies
15
Views
2K
Replies
5
Views
1K
Replies
3
Views
2K
Replies
8
Views
2K
Replies
1
Views
2K
Replies
2
Views
1K
Replies
31
Views
2K
Replies
44
Views
4K
Replies
146
Views
7K
Replies
125
Views
17K