[SciPy-User] fitting data

Johann Cohen-Tanugi cohen at lpta.in2p3.fr
Thu Jul 30 01:49:35 EDT 2009


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 at 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 at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>>     
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>   



More information about the SciPy-User mailing list