Problem 312. Better bullseye matrix
Problem 18 asks to create a bullseye matrix like this:
[ 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 ]
But I think a better one would look like this:
[ 5 4 3 4 5 4 3 2 3 4 3 2 1 2 3 4 3 2 3 4 5 4 3 4 5 ]
Thus given n (always odd), return output a that has concentric rings of the numbers 1 through n around the center point.
Solution Stats
Problem Comments
-
1 Comment
Aamod Garg
on 10 Jun 2018
Its a good problem. Got me back to solving problems at Cody after about 2 months!
Solution Comments
Show commentsGroup

Matrix Patterns I
- 18 Problems
- 60 Finishers
- Pascal's Matrix
- Spot the rectangle (Part 2)
- Spot the rectangle
- Create Volcano (or Atoll) martix. It is an extension of Bullseye matrix problem.
- Magic is simple (for beginners)
- Create Volcano (or Atoll) martix. It is an extension of Bullseye matrix problem.
- Mirror Image matrix across anti-diagonal
- Special matrix
- Make a logical diamond using GALLERY function
- Magic is simple (for beginners)
- Create a Multiplication table matrix...
- Make a Star Pyramid
- "mirror" matrix
- Twist 'n' Match
- Create a matrix X, where each column is a shifted copy of the vector v
- Symmetric matrix
- Create a patchwork matrix
- Spiral In
- Spot the rectangle (Part 2)
- Spot the rectangle
- Matrix spiral
- Better bullseye matrix
Problem Recent Solvers237
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!