Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Curve fitting in C for microcontroller

Status
Not open for further replies.

zereshki

Member level 1
Joined
Jun 15, 2008
Messages
39
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,627
Hello
I need to to make a curve fitting for measured data from A/D of micro in C. The function of curve is nonlinear and can not be lineared . so I need to use Levmar algorithm to find best fit. I test many source that have been written for pc and match them to micro but were not work and didn't find unknown parameters.
Is there somebody who implemented levmar curve fitting in micro controller work properly?

regards
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,418
Helped
14,252
Reputation
28,765
Reaction score
12,942
Trophy points
1,393
Location
Bochum, Germany
Activity points
280,188
What kind of function are you trying to fit to the measured data? Did you choose reasonable initial parameter values? Did you monitor the fitting progress?
 

zereshki

Member level 1
Joined
Jun 15, 2008
Messages
39
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,627
What kind of function are you trying to fit to the measured data? Did you choose reasonable initial parameter values? Did you monitor the fitting progress?

data must be fitted to:

y = p[0] / x + p[1] tanh[ p[2] x ]

and find p[0] , p[1] , p[2]

results all p[] s are zero !

yes I choose initial parameters close to known values(in test program). of course in levmar algorithm even initial parameter be far from, the result are close to best fit.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,418
Helped
14,252
Reputation
28,765
Reaction score
12,942
Trophy points
1,393
Location
Bochum, Germany
Activity points
280,188
If you start with non-zero initial parameters, the iterative process won't arrive at all zero in one step. By watching the parameters and error square sum, you get an idea what goes wrong.

To know reasonable parameters, you can perform the fit with a spread sheet calculator, e.g. the Excel solver.
 

zereshki

Member level 1
Joined
Jun 15, 2008
Messages
39
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,627
If you start with non-zero initial parameters, the iterative process won't arrive at all zero in one step. By watching the parameters and error square sum, you get an idea what goes wrong.

To know reasonable parameters, you can perform the fit with a spread sheet calculator, e.g. the Excel solver.

yes you are right, I never initiate by zero one's. actually I make some numbers by the function plus some reasonable noise.

so I want any ready source that suited for micro without any unused function that have been writen for pc that make source huge code.

regards
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top