I am new to Python and I am trying to fit a complex function. What I have is:
def decay(x,A,d,f,p,c):
return A*numpy.exp(1j*cmath.pi*f*x-d*x+1j*p)+c
guess=[0.01,0.01,0.01,0,0]
onFit, var_matrix=scipy.optimize.curve_fit(decay,x,y,guess)
x
is real and y
is complex. The syntax should work for real function but it seems that it does not work for the complex case.
Is there a simpler way to achieve this task?