From: John D'Errico on
"sarrah " <gto_girlz83(a)yahoo.com> wrote in message <hs6fpo$qnp$1(a)fred.mathworks.com>...
> "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hs6evg$5j0$1(a)fred.mathworks.com>...
> > "sarrah " <gto_girlz83(a)yahoo.com> wrote in message <hs6764$lvb$1(a)fred.mathworks.com>...
> >
> > > How about I still want to use the same vector B[1 0] creates this D matrix as below:
> > > D=
> > > [1 0 0 0 0 0 0 0;
> > > 0 1 0 0 0 0 0 0;
> > > 0 0 0 0 1 0 0 0;
> > > 0 0 0 0 0 1 0 0];
> > >
> > > I don't think we can use the blkdiag function again. Any idea?
> >
> > You need to define how that vector B will generate that
> > array. The crystal ball is cloudy, making it impossible
> > for me to read your mind.
> >
> > John
> ----------------------------------------
> Sorry to confuse you. Lets forget about the vector B and I already constructed that matrix D as I mentioned above but how can I improve it without listing all the columns that I want to delete?
>
> D=eye(16);
> rowToRemove = [3,4,7,8,11,12,15,16];
> D(rowToRemove,:) = [];
> D=[4x8]; %output
>
> Let say the D matrix has bigger size, eye(200) and I don't want to repeat listing all the entries to be remove. We can see the pattern of listing from dToRemove variable. Any better suggestion? Thanks in advance.

Suppose I wanted to paint a picture. Perhaps a
still life, with red apples, oranges, a banana. I have
paint of various colors. I might try to paint it entirely
in one step, with one large brush, arranging some
of the bristles of my brush to hold different paint
pigments. Now were I truly, incredibly good at this,
I might attempt to paint the entire canvas in one
swipe of the brush.

You recognize of course that the above scheme is
surely impossible. Instead, painting my canvas using
one color at a time seems far more logical.

Solve one problem at a time.

John
From: Steven Lord on

"sarrah " <gto_girlz83(a)yahoo.com> wrote in message
news:hs43m5$47l$1(a)fred.mathworks.com...
> Hi,
> Let say I have a vector B=[1 0] and I want to use this vector B repeating
> in this matrix A having size [8x16].
>
> First, I initialize the matrix A with all zeros then I want to have the
> outcome as below:

*snip*

> How can I use that vector B repeat several times on matrix A using some
> code? It looks like an eye matrix but the pattern is little bit different.
> I tried to do some looping but still doesn't get it as the above.

kron(eye(8), [1 0])

> Second question: I still want to use vector B to create another matrix C
> with size [4x8] as below and how to call it without constructing it
> manually?

I don't see the pattern in C, so I don't know how if at all you'll able to
construct it other than manually.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: sarrah on
"Steven Lord" <slord(a)mathworks.com> wrote in message <hs7trc$ssm$1(a)fred.mathworks.com>...
>
> "sarrah " <gto_girlz83(a)yahoo.com> wrote in message
> news:hs43m5$47l$1(a)fred.mathworks.com...
> > Hi,
> > Let say I have a vector B=[1 0] and I want to use this vector B repeating
> > in this matrix A having size [8x16].
> >
> > First, I initialize the matrix A with all zeros then I want to have the
> > outcome as below:
>
> *snip*
>
> > How can I use that vector B repeat several times on matrix A using some
> > code? It looks like an eye matrix but the pattern is little bit different.
> > I tried to do some looping but still doesn't get it as the above.
>
> kron(eye(8), [1 0])
>
> > Second question: I still want to use vector B to create another matrix C
> > with size [4x8] as below and how to call it without constructing it
> > manually?
>
> I don't see the pattern in C, so I don't know how if at all you'll able to
> construct it other than manually.
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
The kron function is also flexible for any size and I don't even know the existing of that function. Thanks Steve.

The vector B cannot be used for implementing the matrix C and I already found the correct vector to replicate it in order to get the matrix C.
First  |  Prev  | 
Pages: 1 2 3
Prev: SVDS inconsistency
Next: fitting model + plotting