Skip to content

Instantly share code, notes, and snippets.

View bqzz's full-sized avatar

Wang Yan bqzz

  • Ubisoft
  • Chengdu, China
View GitHub Profile
@bqzz
bqzz / fourex.py
Created January 5, 2018 09:01 — forked from tartakynov/fourex.py
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x