The **ciespec2cct** function derives the Correlated Colour Temperature (CCT) T_{cp} for a given spectral power distribution (SPD) as in CIE 15:2018. Any errors in the data set or in results generated with the Lighting Toolbox are not in the liability of the CIE nor me, see licence.

Usage:

[Tcp,x,y,u,v] = ciespec2cct(lam,spec,method)

Where:

Parameter | Description |

`Tcp` | Returns the Correlated Colour Temperature: Tcp |

`x and y` | Are the CIE 1931 x and y chromaticity coordinates. |

`u and v` | Are the CIE 1960 u and v chromaticity coordinates. |

`lam` | Defines the wavelengths, vector. |

`spec` | Defines the spectral power distributoin (SPD), vector or matrix. |

`method` | Specifies the determination method:‘Robertson’: (default) Robertson’s calculation algorithm, formerly the only recommended algorithm by the CIE. This method is fast and quite accurate.‘exact’: shortest distance method as described in CIE 15:2018, very accurate but comparably slow. Results may vary with different implementation methods.Both methods return NaN if the colour coordinates lie outside the meaningful interval of \Delta uv < 0.05 from the planckian locus in CIE 1960 chromaticity diagram. |

**Examples**

**Derive Correlated Colour Temperature (CCT) of standard illuminant ‘A’:**

lam = 380:780; spec = ciespec(lam,'A'); Tcp = ciespec2cct(lam,spec)

Result:

Tcp = 2856.0

**Derive Correlated Colour Temperature (CCT) of standard illuminants ‘D65’ and ‘D50’ and the corresponding chromaticity coordinates:**

lam = 380:780; spec = ciespec(lam,{'D65','D50'}); [Tcp,x,y,u,v] = ciespec2cct(lam,spec)

Result:

Tcp = 6501 4999 x = 0.3127 0.3458 y = 0.3291 0.3586 u = 0.3127 0.3458 v = 0.3291 0.3586

**Reference**

`Colorimetry, 4th Edition. Commission International de l’Éclairage (CIE), Vienna Austria, 2018, ISBN: 978-3-902842-13-8 , (DOI: 10.25039/TR.015.2018).`

`Computation of Correlated Color Temperature and Distribution Temperature. In: Journal of the Optical Society of America, vol. 58, no. 11, pp. 1528-1535, 1968, (DOI: 10.1364/JOSA.58.001528).`