Pages: [1]   Go Down
Author Topic: trending formula syntex [solved]  (Read 936 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: July 08, 2012, 04:08:58 am by yair » Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

e. g.:
Code:
f=pow(x,-1.192);
Logged

-Arne

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

-Arne

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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

-Arne

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks, done and solved
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

yahoo!  smiley
*wag tail*

have fun
Logged

-Arne

Pages: [1]   Go Up
Jump to: