RGB
::fromHSV
Convert HSV colors to RGB
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
RGB::fromHSV([h, s, v, <a>]
)
RGB::fromHSV(HSVcolor)
converts color coordinates
in HSV to the corresponding RGB color.
RGB::fromHSV(HSVcolor)
is the inverse of RGB::toHSV
.
With the RGB::fromHSV
utility, all colors
in a MuPAD^{®} graphics can be specified easily as HSV colors. For
example, the color “violet” is given by the HSV values [290,
0.4, 0.6]
, whereas “dark green” is given by
the HSV specification [120, 1, 0.4]
. Hence, a semitransparent
violet sphere intersected by an opaque dark green plain may be specified
as follows:
plot(plot::Sphere(1, [0, 0, 0], Color = RGB::fromHSV([290, 0.4, 0.6]).[0.5]), plot::Surface([x, y, 0.5], x = 1 .. 1, y = 1 .. 1, Mesh = [2, 2], Color = RGB::fromHSV([120, 1, 0.4])) ):
There are numerous ways of displaying complexvalued functions
of a complex argument. For example, see plot::Conformal
. One of these is to
use a color scheme that interprets the complex plane as a section
through HSV color space at a fixed value, for example, 1.
To plot this scheme in MuPAD, use plot::Density
providing the following
color function:
f_color := (x, y, fz, a) > RGB::fromHSV([180/float(PI)*arg(fz), abs(fz), 1]):
The identity function is thus shown as follows:
plot(plot::Density((x, y) > x + I*y, x = 1..1, y = 1..1, XMesh = 50, YMesh = 50, FillColorFunction = f_color))
doubles the argument of a complex function, resulting in the following picture:
plot(plot::Density((x, y) > (x + I*y)^2, x = 1..1, y = 1..1, XMesh = 50, YMesh = 50, FillColorFunction = f_color))
To plot the complex sine function, choose a larger rectangle because the sine is too similar to the identity in small neighborhoods of the origin to be of interest:
plot(plot::Density((x, y) > sin(x + I*y), x = 2..2, y = 2..2, XMesh = 50, YMesh = 50, FillColorFunction = f_color))
is clearly discontinuous along the negative real axis:
plot(plot::Density((x, y) > (x + I*y)^(4/3), x = 1..1, y = 1..1, XMesh = 50, YMesh = 50, FillColorFunction = f_color))

The translucency (alpha) value: a numerical value between 0 and 1. 

The “hue” in an HSV specification: a numerical value between 0 and 360 

The “saturation” in an HSV specification: a numerical value between 0 and 1 

The “value” in an HSV specification: a numerical value between 0 and 1 
A list with three or four floatingpoint values, depending on
whether a
is given in the input.