Problem 46833. Roots, Bloody Roots: part 1/2
Solution Stats
Problem Comments
-
9 Comments
Also it would be great if you add additional checks in test cases, from which we can understand how our solution differs from yours.
For example: check correct value for some points of resulting image (like corners or real/imaginari axis points).
Svyatoslav Golousov, the real axis pointing left is only a convention. However, I will change the problem description later to explain it as I did on the next one. And I will think of a way to measure the similarity between images. I agree it's essential to provide better feedback; thanks for the suggestion.
Hi, Rafael.
I tried your problem and my solution only passed test suite #3.
I used complex number to represent the coordinates. From that, I computed abs() and angle().
I assumed that row m is corresponding to positive y-axis, and column n is positive x-axis.
For m or n is odd, the center is exactly the midpoint of the array 1:m or 1:n,
but for m or n is even, I put two elements for each for the origin.
Therefore, we have 2x2 array for the origin when m and n is even
or 2x1 if m is even and n is odd, or 1x2 m is odd or n is even.
Before that I also tried with simple origin by taking the floor(([m, n]+1)/2).
Unfortunately, those two approaches didn't give the same results as yours.
I plot the `cp` array (m x n x 3) using `image` and the plot is same as your
image.
I also flip the each HSV array, because Matlab use the convention for angle
start from -pi to pi (in this problem it points to negative y axis).
Thank you.
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
951 Solvers
-
Check if number exists in vector
12244 Solvers
-
345 Solvers
-
Is this triangle right-angled?
5961 Solvers
-
350 Solvers
More from this Author5
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!