Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: compose matrix
Replies: 5   Last Post: Jul 27, 2013 3:48 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
eziwarman

Posts: 2
Registered: 7/20/13
Re: compose matrix
Posted: Jul 26, 2013 5:54 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Nasser M. Abbasi" wrote in message <ksfa80$ug6$1@speranza.aioe.org>...
> On 7/20/2013 6:18 PM, eziwarman wrote:
>
>

> >>> hi guys,
> >>> I am having a bit fuzzy to loop the matrix
> >>>
> >>> say you have the matrix (1x4)
> >>> u=[0 -5 0 5 0]
> >>> and construct the matrix into (4x10)
> >>> y=[ 0 -5 0 5 0 0 0 0 0 0;...
> >>> 0 0 0 -5 0 5 0 0 0 0;...
> >>> 0 0 0 0 0 -5 0 5 0 0;...
> >>> 0 0 0 0 0 0 0 -5 0 5];
> >>>
> >>> Thanks

>
> > could you give me a sample
> > i am a new learner with matlab
> >

>
> something like: (btw, the final matrix shuld be 4x11
> not 4x10)
>
> -------------------------
> u=[0 -5 0 5 0];
> M=4;
> N=11;
> A=zeros(M,N);
> offset = 1;
> for i=1:M
> A(i,offset:offset+length(u)-1)=u;
> offset = offset+2;
> end
> -----------------
>
> A =
> 0 -5 0 5 0 0 0 0 0 0 0
> 0 0 0 -5 0 5 0 0 0 0 0
> 0 0 0 0 0 -5 0 5 0 0 0
> 0 0 0 0 0 0 0 -5 0 5 0


Thanks Nasser

Ezi



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.