Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
dVar = [1:5 4:-1:1];
ref = diag(dVar);
user = MatrixFunc();
assert(isequal(user,ref))
ans =
1 0 0 0 0 0 0 0 0
0 2 0 0 0 0 0 0 0
0 0 3 0 0 0 0 0 0
0 0 0 4 0 0 0 0 0
0 0 0 0 5 0 0 0 0
0 0 0 0 0 4 0 0 0
0 0 0 0 0 0 3 0 0
0 0 0 0 0 0 0 2 0
0 0 0 0 0 0 0 0 1
|
2979 Solvers
1600 Solvers
1261 Solvers
Back to basics 21 - Matrix replicating
1052 Solvers
525 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!