yair
July 5, 2012, 5:32am
1
im using a sharp range finder, a long range one (150-550cm, gp2y0a710k0f)
i used excel to generate a strong fitting formula and would like to implement it in arduino

> i post as image as im not clear how to write it.

similar question from old board , but not clear how he got there.

any help welcomed.

yair
July 5, 2012, 6:06am
2
as im not interested in exact distance, just linearity.
f = x^ - 1.192
is good enough ?

is that what u look for:
http://arduino.cc/en/Reference/Pow
?

e. g.:

```
f=pow(x,-1.192);
```

yair
July 6, 2012, 6:14am
4
thanks
using POW was covered in previous question link
im looking to understand rest of formula
i did implment the pow as you showed. looks linear enough

hum
does this help:

In statistics, nonlinear regression is a form of regression analysis in which observational data are modeled by a function which is a nonlinear combination of the model parameters and depends on one or more independent variables. The data are fitted by a method of successive approximations.
In nonlinear regression, a statistical model of the form,
relates a vector of independent variables,
x
{\displaystyle \mathbf {x} }
, and its as...

?

i dont fully understand ur problem...
do u want to know, how excel makes that formula?

yair
July 8, 2012, 6:51am
6
i basically want to write the full formula
but how do i write the first part of formula in arduino syntex > "6E+07"

btw.
sorry for delay i dont get notifications on this post.

oh - ok... it's easy...

it should be like this:

```
float y = 6e7*pow(x,-1.192)
```

6e7 = 6.00E+7 = 6.00pow(10,7) = 6.0 101000 1000