Eye command with a matrix

5 次查看(过去 30 天)
marie
marie 2013-2-20
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 个评论
Santosh
Santosh 2013-2-20
colon is a vectorization operator whose usage is m:n. :3 here is not correct.
marie
marie 2013-2-20
I got it thank you!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by