fourier2

mdhelper.fit.fourier.fourier2(x: ndarray, a0: float, a1: float, b1: float, a2: float, b2: float, omega: float) ndarray[source]

Convenience function for the fourier2 model from MATLAB.

y=a0+a1cos(ωx)+b1sin(ωx)+a2cos(2ωx)+b2sin(2ωx)
Parameters:
xnumpy.ndarray

x-values.

a0float

Constant (intercept) term a0 for the k=0 cosine term.

a1float

Coefficient a1 for the first cos term.

b1float

Coefficient b1 for the first sin term.

a2float

Coefficient a2 for the second cos term.

b2float

Coefficient b2 for the second sin term.

omegafloat

Fundamental frequency ω of the signal.

Returns:
fitnumpy.ndarray

Fitted y-values.