MATLAB Answers

i want to create a array structure using one,zero,eye

25 views (last 30 days)
ajay kumar
ajay kumar on 2 Feb 2016
Commented: ajay kumar on 2 Feb 2016
use the ones, zeroes, eye and addressing commands as appropriate to construct the matrix D, by using upto three lines of command.
3 0 0 2 2
0 3 0 2 2
0 0 3 0 0
Thanks in advance

  0 Comments

Sign in to comment.

Accepted Answer

Moe_2015
Moe_2015 on 2 Feb 2016
D=[3*eye(3),[2*ones(2);zeros(1,2)]]
You can do it in one line as seen here.

More Answers (0)

Sign in to answer this question.