MATLAB Answers

creating an 8x8 matrix using "diag"

11 views (last 30 days)
Liam Sullivan
Liam Sullivan on 22 Jan 2020 at 18:36
Answered: James Tursa on 22 Jan 2020 at 18:38
So im trying to create an 8x8 matrix with 2's in the diagonal but 0s everywhere else. I used diag(8,8)*0 + 2 but that gived me 2's everywhere.

  0 Comments

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 22 Jan 2020 at 18:38
2*eye(8)

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.