What I'm trying to reproduce is a set of functions that convert a vector to RGB values so that the hue goes full circle around the origin. After seeing a 3Blue1Brown video about graphically solving 2D-equations which have 2D outputs, like complex functions, I wanted to replicate the algorithm in Matlab.
The brightening of the colors radiating from the origin is somewhat trivial, but it's the colors I'm interested in.
I decided to fiddle around in MS Paint to see what kinds of values fully saturated RGB colors have. For a red color (brightness half the way) the values are obviously $[255,0,0]$. Similarly for green and blue. Yellow, greenblue (sorry not English :D) and pink have values like $[255, 255, 0]$ and so on. The colors in between are faded appropriately. So for example red is only present in colors ranging from blue to green via red.
What function could be used to convert, say an angle with respect to the x-axis to the amount of red in a direction? I don't care so much about the fade curve or the rotation of the plane above. Only that the colors form a full hue.
Here's a crude visualisation of each color channel:
Any pointers would be greatly appreciated, be them purely mathematical or actual Matlab.