# [SciPy-User] Global Curve Fitting of 2 functions to 2 sets of data-curves

Sebastian Haase seb.haase@gmail....
Thu Jun 10 03:05:57 CDT 2010

```Hi,

so far I have been using scipy.optimize.leastsq to satisfy all my
curve fitting needs.
But now I am thinking about "global fitting" - i.e. fitting multiple
dataset with shared parameters
(e.g. ref here:
http://www.originlab.com/index.aspx?go=Products/Origin/DataAnalysis/CurveFitting/GlobalFitting)

I have looked here (http://www.scipy.org/Cookbook/FittingData) and here
(http://docs.scipy.org/doc/scipy/reference/optimize.html)

Can someone provide an example  ? Which of the routines of
scipy.optimize are "easiest" to use ?

fitting two sets of datasets with two types of functions.
In total I have 10 datasets to be fit with a function f1, and 10 more
to be fit with function f2. Each function depends on 6 parameters
A1,A2,A3, r1,r2,r3.
A1,A2,A3 should be identical ("shared") between all 20 sets, while
r1,r2,r3 should be shared between the i-th set of type f1 and the i-th
set of f2.
Last but not least it would be nice if one could specify constrains
such that r1,r2,r3 >0 and A1+A2+A3 == 1 and 0<=Ai<=1.

;-)  Is this too much ?

Thanks for any help or hints,

Sebastian Haase
```