Search code examples
iphoneobjective-cioscexponential

How to determine a scale factor for a certain set of experimental values


I have a set of experimental values. For instance, I have a value of 1120 pixels and I need to have some kind of factor z to multiply these 1120 pixels to get a value of approximately 1.15. Furthermore, I have 800 pixels and need to multiply this with the same factor z to get a value of approximately 1.2. Here are my experimental values:

1120 * z = approximately 1.15

800  * z = approx. 1.2

720  * z = approx. 1.25

640  * z = approx. 1.3

560  * z = approx. 1.4

480  * z = approx. 1.5

320  * z = approx. 2.0

I don't need values below 1.15 or above 2.0.

So my question is how I determine how big z is. This looks to me a little bit exponential, but I have no idea how to handle this in Objective-C. Any help would be very much appreciated.


Solution

  • It looked exponential to me as well. I figured this out using Grapher.

    Since Grapher is bad at interpolating exponential functions, I plotted the points and modified an exponential equation till I got it pretty close. Then I entered the values I found as the starting point for the interpolation. The equation that you can use in your app is:

    4.3069 * powf(M_E, -x/200.0f) + 1.1327f