home *** CD-ROM | disk | FTP | other *** search
- function m = convmtx(v,n)
- %CONVMTX Convolution matrix.
- % CONVMTX(C,N) returns the convolution matrix for vector C.
- % If C is a column vector and X is a column vector of length N,
- % then CONVMTX(C,N)*X is the same as CONV(C,X).
- % If R is a row vector and X is a row vector of length N,
- % then X*CONVMTX(R,N) is the same as CONV(R,X).
- % See also CONV.
-
- % L. Shure 5-17-88
- % (c) Copyright 1988, by The MathWorks, Inc.
-
- [mv,nv] = size(v);
- lv = max(mv,nv);
- v = v(:); % make v a column vector
- mn = lv + n - 1; % mn == number of rows of M; n == number of columns
- m = toeplitz([v; zeros(n-1,1)],zeros(n,1));
- if mv < nv
- m = m.';
- end
-
-