Problem 18. Bullseye Matrix
Solution Stats
Problem Comments

29 Comments
The image processing toolbox is not available!
A fantastic 1... calculate based on d distance of each element 4m central 1...
I see that now Jan, this stinks!
Nice Problem!
I have a question about why I can't use bwdist to generate the chessboard matrix?
Image Processing ToolBox is not allowed?
Fun problem!
Interesting problem
good problem. What is use of this matrix?
Like this one!!
Had lots of fun figuring it out
Hi guys,
Any one know how can you view a solution with lesser size than the one you submitted ?
Interesting one
never have the chance to see how people did it with less than 10 size
Solving another cody problem you will enable you to see all the solutions to a this problem, and so learning can take place :)
why does my solution work on matlab and not here?
Very challenging problem
Best problem out of those I solved till now.
I have tried using padarray. Its working totally fine with my MATLAB R2017b, but this shows undefined function. Why? Which version cody compiler is compatible with?
Simple Problem, but work out a lot for it, in the end I find the solution too simple. But great thing is I've learned a lot from it.
wow
Nice problem. I like such matrix problems.
Nice One
Love it!!
Nice one....
nice!
really enjoyed it
pretty challenging
finding this one pretty difficult...
search the documentation for Toeplitz Matrix
Solution Comments

1 Comment
Harder one

1 Comment
This one definitely took me a while, showing that I needed to brush up on for and while loops.

1 Comment
required documentation reference, medium difficulty.

1 Comment
Fun project!

1 Comment
Adding comment for testing badges!!

1 Comment
A lot easier than I originally anticipated. Once you start setting up the problem variables, it comes together pretty easily.

1 Comment
nic problem..it was fun

2 Comments
function a = bullseye(n)
a = 1;
for i = 2:(n+1)/2
a = padarray(a, [1,1], i, 'both');
end
end
Why doesn't this function work?
That's probably because padarray() needs Image Processing Toolbox which is not implemented in Cody.

1 Comment
Wow, this wasn't easy for me

3 Comments
clever!
Should be the best for now!
nice! didn't know about discretize til i saw this solution

1 Comment
This is the actual, sans regexp, size of the leading solution: 25

1 Comment
The ans is amazing.Contrast to my last solution,the size add 2.
This solution is from online froum.

1 Comment
my solution clearly works on my matlab. not here. wonder why

1 Comment
Shame you can't use padarray.

2 Comments
it's very nice solution, but sadly it's not general solution
My original objective was to reduce the Cody size as much as possible. You can make this solution general by using y = discretize(spiral(n), [0 1:2:n].^2+.5) or y = discretize(spiral(n), [0 1:2:n].^2, 'IncludedEdge','right'), which has a higher size though.

2 Comments

1 Comment
more elegant solution than a loop: Use the LDL decomposition on the bullseye matrix and you will find an interesting L and D matrix. THe D matrix is diagonale and can be built using n only. THe matrix L is the sum of a lower triangular matrix whose lowest part is put to zero using the mirrored triangular matrix. Finally the identity matrix is added :)

2 Comments

1 Comment
no image processing toolbox then?

2 Comments
:P yeah, I know...
hahahah

2 Comments

3 Comments
funny code!
Not exactly a general solution...
Tester *

1 Comment
This would work if it recognized 'padarray'. Is cody using an older or more spartan version of matlab?

1 Comment
Solutions like this are tricky. It would be nice if we could all agree as a community that this is not a valid way to reduce the size of a solution.

1 Comment
Not fair :(

1 Comment
wow
Problem Recent Solvers5045
Suggested Problems

1968 Solvers

292 Solvers

710 Solvers

Create a vector whose elements depend on the previous element
525 Solvers

606 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!