I want to implement this matrix
显示 更早的评论
0;Ip-l;0.............0
0;0;0;Ip-l;0.......0
.........................
0;0..............0;Ip-l
it is M-Nt x L matrix where M=128
L=65
p=64
1,3,5...columns are zero
2,4,6 columns have Ip-l in consecutive rows
1 个评论
Andrei Bobrov
2012-2-24
M = 96;
N = 128;
A = zeros(M,N);
A(M+1:2*M+1:end) = Ip-1;
采纳的回答
更多回答(3 个)
John D'Errico
2012-2-23
So many ways to do this. My favorite to recognize it as a block diagonal matrix.
d = repmat({[0 Ip-1]},1,64);
M = blkdiag(d{:});
If you want your matrix to be sparse (it surely should be, so why not use the capability?)
d = repmat({sparse([0 Ip-1])},1,64);
M = blkdiag(d{:});
I suppose this would work too. Making it sparse is trivial.
M = toeplitz([0, Ip-1,zeros(1,126)]);
M(2:end,:) = [];
Sean de Wolski
2012-2-23
look at diag, and eye.
doc diag
doc eye
Please provide an actual matrix we can copy and paste into MATLAB (small example) if you would like more detail.
G A
2012-2-23
0 个投票
A=[zeros(64,1),(Ip-l)*eye(64,64)]
6 个评论
Janet
2012-2-23
Sean de Wolski
2012-2-23
Look at what G A's code is doing. I think you need to change the capitalization of one letter.
Janet
2012-2-23
Sean de Wolski
2012-2-23
A(1:2:end,:) = 0;
Janet
2012-2-23
Janet
2012-2-23
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!