annotate Problems/private/add_dc.m @ 39:8f734534839a

(none)
author idamnjanovic
date Mon, 14 Mar 2011 15:35:01 +0000
parents 207a6ae9a76f
children
rev   line source
idamnjanovic@10 1 function x = add_dc(y,dc,columns)
idamnjanovic@10 2 %ADD_DC Add DC channel to signals.
idamnjanovic@10 3 % X = ADD_DC(Y,DC) adds the specified DC value to the (possibly
idamnjanovic@10 4 % multi-dimensional) signal Y, returning the result as X. DC should be a
idamnjanovic@10 5 % scalar value.
idamnjanovic@10 6 %
idamnjanovic@10 7 % X = ADD_DC(Y,DC,'columns') where Y is a 2D matrix and DC is an array of
idamnjanovic@10 8 % length size(Y,2), treats the columns of Y as individual 1D signals,
idamnjanovic@10 9 % adding to each one the corresponding DC value from the DC array. X is
idamnjanovic@10 10 % the same size as Y and contains the resulting signals.
idamnjanovic@10 11 %
idamnjanovic@10 12 % See also REMOVE_DC.
idamnjanovic@10 13
idamnjanovic@10 14 % Ron Rubinstein
idamnjanovic@10 15 % Computer Science Department
idamnjanovic@10 16 % Technion, Haifa 32000 Israel
idamnjanovic@10 17 % ronrubin@cs
idamnjanovic@10 18 %
idamnjanovic@10 19 % April 2009
idamnjanovic@10 20
idamnjanovic@10 21
idamnjanovic@10 22 if (nargin==3 && strcmpi(columns,'columns')), columns = 1;
idamnjanovic@10 23 else columns = 0;
idamnjanovic@10 24 end
idamnjanovic@10 25
idamnjanovic@10 26 if (columns)
idamnjanovic@10 27 x = addtocols(y,dc);
idamnjanovic@10 28 else
idamnjanovic@10 29 x = y + dc;
idamnjanovic@10 30 end
idamnjanovic@10 31
idamnjanovic@10 32
idamnjanovic@10 33