detrend function

Removes trend from data