Weird Diagonal Matrix!! - MATLAB Cody - MATLAB Central

Problem 54715. Weird Diagonal Matrix!!

Difficulty:Rate
**If you have loved the problem, please like it below(Request)**
Given an integer n, create a matrix whose diagonal elements will be square matrices of size 1 to n.
For example:
n=2
z =
1 0 0
0 2 2
0 2 2
n=3
z =
1 0 0 0 0 0
0 2 2 0 0 0
0 2 2 0 0 0
0 0 0 3 3 3
0 0 0 3 3 3
0 0 0 3 3 3

Solution Stats

53.66% Correct | 46.34% Incorrect
Last Solution submitted on Mar 02, 2025

Solution Comments

Show comments

Problem Recent Solvers18

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!
Go to top of page