Problem 42083. Ring Matrix

Given n (only odd), return output matrix a that has concentric rings of the numbers 1 through (n+1)/2 around the center point.

For n = 3,

a = [2 2 2;
     2 1 2;
     2 2 2;]

For n = 5,

a = [3 3 3 3 3;
     3 2 2 2 3;
     3 2 1 2 3;
     3 2 2 2 3;
     3 3 3 3 3;]

Solution Stats

41.54% Correct | 58.46% Incorrect
Last Solution submitted on Feb 28, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers25

Suggested Problems

More from this Author1

Problem Tags

Community Treasure Hunt

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

Start Hunting!