speccentroid
The speccentroid function determines the spectral centroid or “center of mass” for any given spectral power distribution (SPD) as in the following equation:
\lambda_{\textrm{c}} = \frac{\sum \lambda \cdot s(\lambda) \,\textrm{d}\lambda}{\sum s(\lambda) \,\textrm{d}\lambda}See also: specpeak
Usage:
sc = speccentroid(lam,spec)
Where:
| Parameter | Description |
sc | Returns the spectral centroid, or center of mass wavelength. |
lam | Specifies the wavelengths, vector or matrix. |
spec | Specifies the spectral power distribution(s), vector or matrix. |
Examples:
Determine spectral centroid of the V(\lambda) curve:
lam = 380:780;
VL = ciespec(lam,'VL');
sc = speccentroid(lam,VL)
% plotting the result
plot(lam,VL)
grid minor
hold on
plot([sc sc],[0 1],'k--')
xlabel('\lambda in nm')
ylabel('relative SPD')
hold off
See also: ciespec
Result:
sc = 560.19

Determine the spectral centroids of the α-opic functions:
lam = 380:780; spec = ciespec(lam,'aopic'); aopiccent = speccentroid(lam,spec)
See also: ciespec
Result:
aopiccent = 450.03 536.41 561.34 502.40 489.69