### Merge branch 'pr#1583'

parents 82de9c1d e6cc7d6a
 function c = demean(x) % Removes the mean of each column of a matrix. %@info: %! @deftypefn {Function File} {@var{c} =} demean (@var{x}) %! @anchor{demean} %! This function removes the mean of each column of a matrix. %! %! @strong{Inputs} %! @table @var %! @item x %! Matlab matrix (T-by-N). %! @end table %! %! @strong{Outputs} %! @table @var %! @item c %! Matlab matrix (T-by-N). The demeaned x matrix. %! @end table %! %! @strong{This function is called by:} %! @ref{compute_cova}, @ref{compute_acov}, @ref{compute_std}. %! %! @strong{This function calls:} %! @ref{ndim}, %! %! @end deftypefn %@eod: % Removes the mean of each column of a matrix. % % INPUTS % - x [double] T*N matrix of data. % % OUTPUTS % - c [double] T*N matrix of demeaned data. % Copyright (C) 2011-2017 Dynare Team % Copyright (C) 2011-2018 Dynare Team % % This file is part of Dynare. % ... ... @@ -44,12 +25,8 @@ function c = demean(x) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . % Original author: stephane DOT adjemian AT univ DASH lemans DOT fr if ndim(x)>2 error('This function is not implemented for arrays with dimension greater than two!') end if ndim(x)==1 c = x-mean(x); elseif ndim(x)==2 c = bsxfun(@minus,x,mean(x)); else error('descriptive_statistics::demean:: This function is not implemented for arrays with dimension greater than two!') end \ No newline at end of file c = bsxfun(@minus, x, nanmean(x)); \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!