Inspired by Problem 18, create a bullseye matrix with the addition of padding equal to 0 between concentric rings. Matrices are square with outer ring equal to input n.
n=1
1
n=2
2 2 2 2 2
2 0 0 0 2
2 0 1 0 2
2 0 0 0 2
2 2 2 2 2
n=3
3 3 3 3 3 3 3 3 3
3 0 0 0 0 0 0 0 3
3 0 2 2 2 2 2 0 3
3 0 2 0 0 0 2 0 3
3 0 2 0 1 0 2 0 3
3 0 2 0 0 0 2 0 3
3 0 2 2 2 2 2 0 3
3 0 0 0 0 0 0 0 3
3 3 3 3 3 3 3 3 3
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers11
Suggested Problems
-
Remove any row in which a NaN appears
8770 Solvers
-
Project Euler: Problem 3, Largest prime factor
1788 Solvers
-
Duplicate each element of a vector.
635 Solvers
-
Rotate input square matrix 90 degrees CCW without rot90
681 Solvers
-
Divide elements by sum of elements
138 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!