Eye command with a matrix

Use the eye command to create the array A shown on the left below. Then use the
colon to address elements in the arrays and the eye command to change A to match the array
shown on the right.
So far I have tried
A=eye(7,7)
A=[2,2,2,0,5,5,5;2,2,2,0,5,5,5;3,3,3,0,5,5,5;0,0,0,1,0,0,0;4,4,7,0,9,9,9;4,4,7,0,9,9,9;4,4,7,0,9,9,9]
to match the array i did
B=[A eye(7,0)]

7 comentarios

Image Analyst
Image Analyst el 20 de Feb. de 2013
Editada: Image Analyst el 20 de Feb. de 2013
So? What's wrong with that? It produces the "A" array you want. Do you have a question? I'm not sure what B is for.
marie
marie el 20 de Feb. de 2013
because it asks to use the colon to address elements in the arrays I'm not sure if A=[2,2,2,0,5,5,5;2,2,2,0,5,5,5;3,3,3,0,5,5,5;0,0,0,1,0,0,0;4,4,7,0,9,9,9;4,4,7,0,9,9,9;4,4,7,0,9,9,9] is right
and the B is just to give the new array a name
Sean de Wolski
Sean de Wolski el 20 de Feb. de 2013
I don't see any correlation between an identity matrix and that matrix B.
If you need to use colon:
I = eye(7);
I(1:2,1:3) = 2;
I(1:2,5:7) = 5;
etc. until it's filled up.
Youssef  Khmou
Youssef Khmou el 20 de Feb. de 2013
its right, are you sure its "eye" not "ones " ?
marie
marie el 20 de Feb. de 2013
Editada: marie el 20 de Feb. de 2013
when I do I(:3,1:3) = 3 it gives me an error did i use the wrong command?
Santosh
Santosh el 20 de Feb. de 2013
colon is a vectorization operator whose usage is m:n. :3 here is not correct.
marie
marie el 20 de Feb. de 2013
I got it thank you!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Design and Simulate SerDes Systems en Centro de ayuda y File Exchange.

Preguntada:

el 20 de Feb. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by