multiply spectra by coefficients and return modified object
1 2 3 4 5
a colorSpec object with M spectra
a scalar, an M-vector, or an MxP matrix
s is an MxP matrix, say S, and one thinks of the spectra as
organized in an NxM matrix X,
then the new spectra are defined by the matrix XS, which is NxP.
If the P column names of
s are set, then they are copied to the spectrum names of the output.
Otherwise, default spectrum names are assigned as in
s is an M-vector, then S=
diag(s) is computed and used in the previous sentence.
This has the effect of multiplying spectrum i by
s is a scalar then every spectrum is multiplied by
The multiplication may produce negative entries, but no check is made for this.
WARNING: An M-vector and an Mx1 matrix may yield quite different results.
s = an M-vector.
If the norm of a spectrum is 0, then it is left unchanged.
multiply returns a colorSpec object with the matrix of spectra
x multiplied by
normalize returns a colorSpec object with each spectrum
x scaled to have given norm equal to 1.
In both functions, the
wavelength are preserved.
x is organized as a matrix, and
s is a scalar,
the one can use the simpler and equivalent
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.