Go Down

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

yair

Jul 05, 2012, 07:32 am Last 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

as im not interested in exact distance, just linearity.
f = x^ - 1.192
is good enough ?

RIDDICK

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

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

yair

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

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?
-Arne

yair

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

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
-Arne

yair


RIDDICK

-Arne

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy