From: Matt J on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hetvjb$bg6$1(a)fred.mathworks.com>...
> "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hetug6$5g4$1(a)fred.mathworks.com>...
>
> >
> > Here's another one. It's efficient in syntax, but not in execution:
> >
> > A=kron( speye(N), [a,b,c]); %N is number of recurrences of the blocks
>
> The structure of the blocks generated like the above are disjoint like SPDIAGS, not like TOEPLITZ.
>

Yeah. Oh well, just for the hell of it, here's a brute force way, using kron()

e=ones(N,1);
A=kron(spdiags(e,0,N,N+2),a)+...
kron(spdiags(e,1,N,N+2),b)+...
kron(spdiags(e,2,N,N+2),c)
From: Jos (10584) on
"Ahmad " <aarg_2010(a)yahoo.com> wrote in message <het6s3$q5f$1(a)fred.mathworks.com>...
> Hi,
>
> Is there any method in Matlab to generate a BLOCK Toeplitz matrix whose structure is
>
> [a b c 0 0
> 0 a b c 0
> 0 0 a b c ]
>
> where a,b, c, and all 0's are COLUMN vectors of the same length r x 1.

Here is a aproach

% original arrays
r = 4 ;
a = rand(r,1) ; b = 10*rand(size(a)) ; c = 10*rand(size(a)) ;

% create block toeplitz matrix
X = {zeros(size(a)) a b c} ;
idx = toeplitz([1:3 0 0],[0 0 0]).' + 1 % indices
X = X(idx)
X = cell2mat(X)
% or in 1 step: X = cell2mat(X (toeplitz(..)+1))

hth
Jos
First  |  Prev  | 
Pages: 1 2
Prev: ScatterHist m file
Next: treefit maxium pruning level