Using Fminsearch to fit two functions recursively
2 views (last 30 days)
Show older comments
Hi Matlab community,
I am trying to fit this xdata and ydata with Fminsearchbnd to extract 4 parameters using the following functions (see attached document)
Function 1: psi = [(Kf + Kb)Ro' - Kb] * exp(-Kf-Kb)
Function 2: Ro'' = (psi + Kb) / (Kf + Kb)
where
psi = ydata / (2*96485*0.045*0.2e-12 / 0.0083)
Kf = Ko * exp(-alpha*((2*96485)/(8.314*298))*(xdata-Enot))
Kb = Ko * exp((1-alpha)*((2*96485)/(8.314*298))*(xdata-Enot))
Ro' is at t = 0 and Ro'' is at t + 0.00833 and are interlinked with this equation Ro' = Ro / 0.2e-12 or Ro'' = Ro / 0.2e-12.
The initial guesses for Ko, alpha, Ro and Enot are: 0.1 (range between 1e-6 to 1e5), 0.5 (range between 0.3 to 0.7), 1 (no range) and -0.26 (range from -0.35 to -0.15), respectively.
Each function should be used recursively at each xdata point and how can I incorporate the second function?
So far, I have been able to fit the first point but it is not following and the initial guesses appear to influence the outcome of the fit...
Any help would be greatly appreciated!
Thanks!

9 Comments
jgg
on 26 Apr 2016
It depends on your problem; if you have a pretty good idea where your solution should be, fminsearch is probably good enough. Otherwise, you can try ga the genetic algorithm or patternsearch if you have those toolboxes. Otherwise, it's best to just test a lot of starting points.
Answers (0)
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
