Function icm = colourgrade_icm(x,cg)
returns the row index to the colour map for
each value in matrix x.
At input, the struct cg must have the following
fields:
cg.gradevalues (column vector of reals)
cg.delta (row vector of two reals)
cg.icm_infra (row index to cg.colourmap)
cg.icm_min (row index to cg.colourmap)
cg.icm_max (row index to cg.colourmap)
cg.icm_ultra (row index to cg.colourmap)
cg.icm_nanan (row index to cg.colourmap)
The colour with index j ranging from
cg.icm_min (inclusively) to cg.icm_max
(inclusively) is attributed to finite
reals x(k), depending on the following
condition:
cg.gradevalues(j) <= x(k) < cg.gradevalues(j+1)
The colours with indices cg.icm_min and
cg.icm_max are attributed to finite
reals x(k), depending on the following
conditions by application of the two
tolerances in cg.delta:
cg.gradevalues(1) - cg.delta(1) <= x(k) < cg.gradevalues(1+1)
and
cg.gradevalues(end) <= x(k) <= cg.gradevalues(1) + cg.delta(2)
respectively.
Consequently, we have the following
conditions for the colours with indices
cg.icm_infra and cg.icm_ultra:
x(k) < cg.gradevalues(1) - cg.delta(1)
and
x(k) > cg.gradevalues(1) + cg.delta(2)
respectively.
(c) 2026 fabien van mook
2026.08.20 release of this file within package "fvm-colourgrade" under GNU GPLv3+