[SciPy-User] fitting data
Johann Cohen-Tanugi
cohen@lpta.in2p3...
Thu Jul 30 02:34:36 CDT 2009
Bala, I think that you are mistyping your problem : the second equation
looks a lot like one of the 2 solutions of a second order polynom a0*X^2
-2*(a0+x+b0)*X+b0
Is that right?
In any case, replace a by (f-f0)/(fb-f0) in eq.2 and then you have
an implicit function g(x,b0)
Johann
Bala subramanian wrote:
> Sorry for not giving clear info. in my previous mail.
>
> Actually, i have two equations 1) f = a * fb + (1-a) fo, where f, fb,
> fo are known
>
> and 2) a = 1/2ao[ (ao + x + bo) - { (ao + x + bo)2 - 4 ao bo }0.5 ]
>
> From eq 1, i should get 'a' and then i use this in eq 2 to find bo.
>
> On Thu, Jul 30, 2009 at 7:49 AM, Johann Cohen-Tanugi
> <cohen@lpta.in2p3.fr <mailto:cohen@lpta.in2p3.fr>> wrote:
>
> I thinkk he means that f0 and fb are two known function of x, and
> he is
> interested in the weight parameter a.
> You can try :
> from scipy import optimize
> def func(x,a): return a * fb(x) + (1-a) fo(x)
> fitp,cov=optimize.curve_fit(func,x,p)
>
> that is one of many options....
> Johann
>
>
>
> Chris Colbert wrote:
> > maybe i don't understand what you are asking, but if (a) is your
> only
> > unknown, just do:
> >
> > a = (f - f0) / (fb - f0)
> >
> >
> >
> > On Thu, Jul 30, 2009 at 1:32 AM, Bala
> > subramanian<bala.biophysics@gmail.com
> <mailto:bala.biophysics@gmail.com>> wrote:
> >
> >> Friends,
> >>
> >> I am new and just joined the scipy community. I want to fit
> (least sq. fit)
> >> my data to the following equation. I would greatly appreciate
> if someone
> >> could help me with a sample code on how fitting is done with scipy.
> >>
> >> The function is : f = a * fb + (1-a) fo, where f, fb, fo are known.
> >>
> >> Regards,
> >> Bala
> >>
> >>
> >>
> >> _______________________________________________
> >> SciPy-User mailing list
> >> SciPy-User@scipy.org <mailto:SciPy-User@scipy.org>
> >> http://mail.scipy.org/mailman/listinfo/scipy-user
> >>
> >>
> >>
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User@scipy.org <mailto:SciPy-User@scipy.org>
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> >
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org <mailto:SciPy-User@scipy.org>
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
More information about the SciPy-User
mailing list