DETREND removes the trend from data, NaN's are considered as missing values DETREND is fully compatible to previous Matlab and Octave DETREND with the following features added: - handles NaN's by assuming that these are missing values - handles unequally spaced data - second output parameter gives the trend of the data - compatible to Matlab and Octave [...]=detrend([t,] X [,p]) removes trend for unequally spaced data t represents the time points X(i) is the value at time t(i) p must be a scalar [...]=detrend(X,0) [...]=detrend(X,'constant') removes the mean [...]=detrend(X,p) removes polynomial of order p (default p=1) [...]=detrend(X,1) - default [...]=detrend(X,'linear') removes linear trend [X,T]=detrend(...) X is the detrended data T is the removed trend see also: SUMSKIPNAN, ZSCORE