フィルターのクリア

How to generate the following matrix

1 回表示 (過去 30 日間)
Ace_ventura
Ace_ventura 2015 年 2 月 8 日
コメント済み: Ace_ventura 2015 年 2 月 8 日
I have x=[1 2 1 1; 4 5 1 1 ; 7 8 1 1]. I want a matrix in which this matrix repeats itself 10 times using repmat function and with each repetition the first and second columns of the basic matrix ,that is x, increase by 5. Thus my fourth, fifth and sixth row (first repetition) will be [6 7 1 1 ; 9 10 1 1 ; 12 13 1 1] .In second repetition ,that is 7th,8th and 9th row, it would be [11 12 1 1 ; 14 15 1 1 ; 17 18 1 1 ] and so on till 10 repetitions are performed
  1 件のコメント
per isakson
per isakson 2015 年 2 月 8 日
homework?

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

採用された回答

Roger Stafford
Roger Stafford 2015 年 2 月 8 日
y = repmat(x,10,1);
y(:,1:2) = y(:,1:2) + repmat(5*floor((0:29).'/3),1,2);
  3 件のコメント
Roger Stafford
Roger Stafford 2015 年 2 月 8 日
It worked for me. Did you start with x as a 3-by-4 array?
Ace_ventura
Ace_ventura 2015 年 2 月 8 日
yeah i got it..A typing error on my part.Thanks a lot Roger _

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by