# Fityk 1.1.2

### see https://github.com/wojdyr/fityk/wiki/Southern-Oscillation

set lm_stop_rel_change=1e-20, numeric_format='%.10E', default_sigma=one

# load index as x and column 1 as y
@0 < '_SCRIPT_DIR_/enso.dat:0:1::'
# now x is set as 0-based index, we prefer 1-based index
X=n+1

plot [] [-5:]

#define Enso(b1, b2, b3, b4, b5, b6, b7, b8, b9) = b1 + b2*cos(t/12) + b3*sin(t/12) + b5*cos(t/b4) + b6*sin(t/b4) + b8*cos(t/b7) + b9*sin(t/b7) where t=2*pi*x
#F = Enso(~11.0, ~3.0, ~0.5, ~40.0, ~-0.7, ~-1.3, ~25.0, ~-0.3, ~1.4)

define Cycle(period, a, b) = a*cos(2*pi*x/period) + b*sin(2*pi*x/period)
F = Constant(~11) + Cycle(12, ~3.0, ~0.5) + Cycle(~40.0, ~-0.7, ~-1.3) + Cycle(~25.0, ~-0.3, ~1.4)

fit
info errors
