home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 8.ddi / SIGNAL.DI$ / CONVMTX.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  648 b   |  22 lines

  1. function m = convmtx(v,n)
  2. %CONVMTX Convolution matrix.
  3. %    CONVMTX(C,N) returns the convolution matrix for vector C.
  4. %    If C is a column vector and X is a column vector of length N,
  5. %    then CONVMTX(C,N)*X is the same as CONV(C,X).
  6. %    If R is a row vector and X is a row vector of length N,
  7. %    then X*CONVMTX(R,N) is the same as CONV(R,X).
  8. %    See also CONV.
  9.  
  10. %    L. Shure 5-17-88
  11. %    (c) Copyright 1988, by The MathWorks, Inc.
  12.  
  13. [mv,nv] = size(v);
  14. lv = max(mv,nv);
  15. v = v(:);        % make v a column vector
  16. mn = lv + n - 1;    % mn == number of rows of M; n == number of columns
  17. m = toeplitz([v; zeros(n-1,1)],zeros(n,1));
  18. if mv < nv
  19.     m = m.';
  20. end
  21.  
  22.