Thread Subject: use of matrix repeatedly

Subject: use of matrix repeatedly

From: munir

Date: 3 Nov, 2009 22:20:43

Message: 1 of 5

hi
i want to assemble a new matrix in which same submatrix is repeated
many times.
for example k=[1,2;2,1]
if m=1
ka=[k]
if m=2
ka=[k,k;k,k]
if m=3
ka=[k,k,k;k,k,k;k,k,k]
and so on....
how can i accomplish this task?????
plz help if possible.
thanks n regards.

Subject: use of matrix repeatedly

From: Matt Fig

Date: 3 Nov, 2009 22:30:17

Message: 2 of 5

See the help for repmat.

Subject: use of matrix repeatedly

From: Loren Shure

Date: 5 Nov, 2009 15:55:38

Message: 3 of 5

In article <10da359e-f86e-496d-b2d4-a171b447d346
@h14g2000pri.googlegroups.com>, munirpansare@gmail.com says...
> hi
> i want to assemble a new matrix in which same submatrix is repeated
> many times.
> for example k=[1,2;2,1]
> if m=1
> ka=[k]
> if m=2
> ka=[k,k;k,k]
> if m=3
> ka=[k,k,k;k,k,k;k,k,k]
> and so on....
> how can i accomplish this task?????
> plz help if possible.
> thanks n regards.
>

Another poster mentioned repmat. Maybe you don't even need the full
array, but to operate with it. If so, bsxfun might be able to help.

--
Loren
http://blogs.mathworks.com/loren

Subject: use of matrix repeatedly

From: Bobby Cheng

Date: 5 Nov, 2009 16:28:19

Message: 4 of 5

What are you going to do with the result? Do you have to form the matrix?
---Bob.

"Loren Shure" <loren.shure@mathworks.com> wrote in message
news:MPG.255cbf8175b9216e989a5f@news.mathworks.com...
> In article <10da359e-f86e-496d-b2d4-a171b447d346
> @h14g2000pri.googlegroups.com>, munirpansare@gmail.com says...
>> hi
>> i want to assemble a new matrix in which same submatrix is repeated
>> many times.
>> for example k=[1,2;2,1]
>> if m=1
>> ka=[k]
>> if m=2
>> ka=[k,k;k,k]
>> if m=3
>> ka=[k,k,k;k,k,k;k,k,k]
>> and so on....
>> how can i accomplish this task?????
>> plz help if possible.
>> thanks n regards.
>>
>
> Another poster mentioned repmat. Maybe you don't even need the full
> array, but to operate with it. If so, bsxfun might be able to help.
>
> --
> Loren
> http://blogs.mathworks.com/loren
>

Subject: use of matrix repeatedly

From: Sebastian Arslanogullari

Date: 5 Nov, 2009 19:11:02

Message: 5 of 5

This could be done in several ways, e.g.
k2=repmat(k,m,m);
or you can use kronecker tensor product:
k2 = kron(ones(m),k);
Regards
Sebastian

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com