
Since the highest period (or the inverse of your lowest non-zero frequency) you are able to resolve is equal to the length of time of your data, the appearance of a linear trend could mean that your data are essentially superimposed on a sine wave with a period many times greater than that of the highest period you can resolve (which is why at first glance the trend may look linear).

A linear-looking trend in your data, on the other hand, may actually be a combination of the higher frequency data (you are after) and a very low-frequency sine wave. This is easy to remove by either using the detrend(data,'constant') function OR by transforming the data into the frequency domain and changing the zero-frequency amplitude to zero. In the frequency domain, a constant offset (or the mean of the data) is simply the amplitude at zero frequency. "Denoising based on Time-Shift PCA." Journal of Neuroscience Methods 165: 297-305.Most "real" data can contain constant offsets and, what I believe to be the appearance of, linear trends. "Sensor Noise Suppression." Journal of Neuroscience Methods 168: 195-202. "Denoising based on spatial filtering." Journal of Neuroscience Methods 171: 331-339. Journal of Neuroscience Methods 189: 113-120. "Time-shift denoising source separation." "Quadratic component analysis." Neuroimage 59: 3838-3844. "Component analysis reveals sharp tuning of the local field potential

#DETREND MATLAB CODE#
DO NOTĮXPECT YOUR CODE TO WORK WITH NEWER VERSIONS. Make an archival copy of any code you use. WARNING: this code is under development and may radically change

Suppress various sources of environmental, sensor, and physiological noise.ĭocumentation is minimal, but a (very) few example scripts

NoiseTools implements several new algorithms that are effective to NoiseTools is a Matlab toolbox to denoise and analyze multichannelĮlectrophysiological data, such as from EEG, MEG, electrode arrays, optical
