Let's say I have a function f(x,a,b,c)
in Python that (just as an example) could look something like this:
def f(x,a,b,c):
return a*x*x + b*x + c
(just as a general example; my function does not look like that)
The following
import scipy.optimize as opt
x = range(1,10)
y = range(2,11)
output = opt.curvefit(f,x,y)
would find the values of a
,b
, and c
that best fit f(x,a,b,c)
to y
.
Let's say now that, with f(x,a,b,c)
still defined the same way above, I want to fix one of the parameters (let's say a
). Is there any way I can still use opt.curvefit(f,x,y) with f
still defined as above but with a
fixed?
To be specific: I still want to be able to pass a
to f
, I just don't want it to be a parameter that gets varied when curvefit()
tries to fit f(x,a,b,c)
to y
.