# Correct array dimensions for 'sam' function?

2 views (last 30 days)
Steve Francis on 9 Jan 2023
Commented: Steve Francis on 9 Jan 2023
I have an array (called 'DataCube') that has size [1024, 1280, 427]. It was formed from 16-bit images of a 2-d scene (1280x1024 pixels) that was captured at 427 different wavelengths. The scene contains up to 10 different materials to be identified.
Using a spectrometer, the reflectance spectrum of a reference sample of each material was captured. The reference spectrum had 2580 wavelength data points. I could therefore construct an array called 'endmembers' that has dimension size [2580, 10]. Important: Note that the wavelength interval in 'endmembers' is much finer than the interval in 'DataCube'.
I would like to use the 'sam' function to compute the spectral angular distance between each endmember and the spectrum of each pixel in the hypercube. An example is shown here: https://uk.mathworks.com/help/images/ref/sam.html#mw_8ac1f412-e27b-41c1-b228-6b3550f86fca
However, in that example, the number of wavelength bands in the 'DataCube' is equal to the number of wavelength bands in 'endmembers'.
How can I best process my 'endmembers' array so that it will be correctly interpreted by 'sam'? I think that I may have to use some form of interpolation to reduce the size of my 'endmembers' to [427, 10]. The wavelength values in 'DataCube' are whole numbers (e.g. 550, 552, 554 etc.) but the wavelength values in 'endmembers' are fractions (e.g. 549.908, 550.226, 550.544, 550.861 etc).
Steve Francis on 9 Jan 2023
Also, I assume that all values can all be doubles? The example shows the the endmembers as int16.

### Categories

Find more on Elementary Polygons in Help Center and File Exchange

R2022a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by