Date: Jan 27, 2014 2:11 PM
Author: Milos Milenkovic
Subject: Better way to generate a matrix

Dear, 
how to get the same result for L14 (obtained by Method 1, which have to be modified for various lengths of Pih vector), but now by including variable length of input Pih vector (Method 2)?

Method 1
N=3;
P=3;
Pih1=[25 15 10];
L11=repmat(Pih1(1),N,N-1);
L12=repmat(Pih1(2),N,N-1);
L13=repmat(Pih1(3),N,N-1);
L14=blkdiag(L11, L12, L13);

Method 2
for i=1:length(Pih1)
L00=repmat(Pih1(i),N,N-1)
L0=blkdiag(L00, L00, L00)
end

Thanks.