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
Andrei Bobrov 2012 年 2 月 24 日
M = 96;
N = 128;
A = zeros(M,N);
A(M+1:2*M+1:end) = Ip-1;

サインインしてコメントする。

 採用された回答

Dr. Seis
Dr. Seis 2012 年 2 月 23 日

1 投票

>> A = zeros(4,8);
>> A(:,2:2:end) = 5*eye(4,4);
>> A
A =
0 5 0 0 0 0 0 0
0 0 0 5 0 0 0 0
0 0 0 0 0 5 0 0
0 0 0 0 0 0 0 5

3 件のコメント

Janet
Janet 2012 年 2 月 23 日
yes..this is I want..but I needed 96 x 128 matrix
Dr. Seis
Dr. Seis 2012 年 2 月 23 日
Provided N is even:
M = 96;
N = 128;
A = zeros(M,N);
A(:,2:2:end) = (Ip-1)*eye(M,N/2)
Janet
Janet 2012 年 2 月 23 日
Yes..I got it..thank you so much and without your help, I wouldn't have got a solution..thank you so much

サインインしてコメントする。

その他の回答 (3 件)

John D'Errico
John D'Errico 2012 年 2 月 23 日

1 投票

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,:) = [];

2 件のコメント

Janet
Janet 2012 年 2 月 23 日
using first command..how can i get 96 x 128 matrix
Janet
Janet 2012 年 2 月 24 日
d = repmat({[0 Ip-1]},1,64);
M = blkdiag(d{:});
using this command...i want 96x128 matrix...i.e M-Nt x L matrix
M=128;Nt=2;L=16

サインインしてコメントする。

Sean de Wolski
Sean de Wolski 2012 年 2 月 23 日

0 投票

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
G A 2012 年 2 月 23 日

0 投票

A=[zeros(64,1),(Ip-l)*eye(64,64)]

6 件のコメント

Janet
Janet 2012 年 2 月 23 日
0 48 0 0 0
0 0 48 0 0
0 0 0 48 0
0 0 0 0 48
i don't want such matrix
0 Ip-L 0.........................0
0 0 0 Ip-L 0................ 0
................................
................................
0 0 0.......................0 Ip-L
I want the above matrix
Sean de Wolski
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
Janet 2012 年 2 月 23 日
GA's code is like this:
0 48 0 0 0
0 0 48 0 0
0 0 0 48 0
0 0 0 0 48
but I want 1,3,5...columns to be zero
2,4,6,....columns to have Ip-l in consecutive rows
Sean de Wolski
Sean de Wolski 2012 年 2 月 23 日
A(1:2:end,:) = 0;
Janet
Janet 2012 年 2 月 23 日
what is 1:2?
Janet
Janet 2012 年 2 月 23 日
I need a M-Nt x L matrix i.e 96 x 128

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

タグが未入力です。

質問済み:

2012 年 2 月 23 日

編集済み:

2013 年 10 月 23 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by