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