Python Forum

Full Version: minimize with scipy.optimize
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi evrybody,

i have a noisy signal df.measdata and want to fit a model function in my measurement data. the model function is a sinus, whoms frequency and amplitude can be adapted by the optimizer. i tried a lot already, but scipy.optimize is not working for me, res.x just returns very high numbers for the variables

x0=[1,1]
fun = lambda x: sum(x[0]*np.sin(x[1]*df.timestamp)-df.measdata)
res = minimize(fun, x0, method='Nelder-Mead', tol=0.001)
res.x
can anyone explain which mistake i make?

cheers and regards