Home > NoiseTools > nt_detrend2.m

nt_detrend2

PURPOSE ^

[y,w,r]=nt_detrend2(x,varargin) - robustly remove trend,

SYNOPSIS ^

function [y,w,r]=nt_detrend2(x,varargin)

DESCRIPTION ^

[y,w,r]=nt_detrend2(x,varargin) - robustly remove trend, 
 
 Same as nt_detrend, but for 3D data (samples X channels X trials) the same
 trend is removed from all trials.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [y,w,r]=nt_detrend2(x,varargin)
0002 %[y,w,r]=nt_detrend2(x,varargin) - robustly remove trend,
0003 %
0004 % Same as nt_detrend, but for 3D data (samples X channels X trials) the same
0005 % trend is removed from all trials.
0006 %
0007 
0008 
0009 if iscell(x)
0010     error('not implemented'); 
0011 end
0012 if nargout>1;
0013     error('single output only');
0014 end
0015 
0016 xx=mean(x,3);
0017 yy=nt_detrend(xx,varargin{:});
0018 trend=xx-yy;
0019 y=bsxfun(@plus,x,-trend);
0020

Generated on Sat 29-Apr-2023 17:15:46 by m2html © 2005