Convert spectrum to color

This simple script can convert reflective/transmissive spectra to color and plot it in the CIE 1931 diagram.
901 Downloads
Updated 6 Apr 2025

View License

%It can load spectrum from an excel, the format should as follow:
%column 1: wavelength data(unit: nm/m)
%column 2 to n: reflectance/transmittance spectrum
%The default light source is D65,one can change light source in
%spectrum2XYZ function
%Author:Tingbiao Guo, Zhejiang University, email:tbguo@zju.edu.cn

Cite As

Tingbiao Guo (2026). Convert spectrum to color (https://www.mathworks.com/matlabcentral/fileexchange/98289-convert-spectrum-to-color), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2023a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.0.2

add function to calculate color gamut

1.0.1

bug delete.

1.0.0