Go Down

### Topic: trending formula syntex [solved] (Read 1 time)previous topic - next topic

#### yair

##### Jul 05, 2012, 07:32 amLast Edit: Jul 08, 2012, 11:08 am by yair Reason: 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

#1
##### Jul 05, 2012, 08:06 am
as im not interested in exact distance, just linearity.
f = x^ - 1.192
is good enough ?

#### RIDDICK

#2
##### Jul 05, 2012, 08:19 am
is that what u look for:
http://arduino.cc/en/Reference/Pow
?

e. g.:
Code: [Select]
`f=pow(x,-1.192);`

#### yair

#3
##### Jul 06, 2012, 08:14 am
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

#### RIDDICK

#4
##### Jul 06, 2012, 08:26 am
hum
does this help:
http://en.wikipedia.org/wiki/Nonlinear_curve_fitting
?

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

#### yair

#5
##### Jul 08, 2012, 08:51 am
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.

#### RIDDICK

#6
##### Jul 08, 2012, 08:54 am
oh - ok... it's easy...

it should be like this:
Code: [Select]
`float y = 6e7*pow(x,-1.192)`

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

#### yair

#7
##### Jul 08, 2012, 10:22 am
thanks, done and solved

#8
yahoo!
*wag tail*

have fun

Go Up