specbandwidth
The specbandwidth function determines the bandwidth of a narrowband spectral power distributions (SPDs) at one half peak maximum or other thresholds.
Usage:
[sbw,lam1,lam2] = specbandwidth(lam,spec,threshold,method)
Where:
| Parameter | Description | 
| sbw | Is the returned spectral bandwidth | 
| lam1 | Returns the left side of the spectral bandwidth | 
| lam2 | Returns the right side of the spectral bandwidth | 
| lam | Is the input vector or matrix containing the wavelengths, row-wise | 
| spec | Is the input vector or matrix containing the spectral power distribution, row-wise | 
| threshold | Defines at which percentage of the peak at which the bandwidth is to be determined, default: 50. | 
| method | Defines the interpolation method, used to determine the wavelengths: ‘linear’: Linear interpolation from nearest neighbours (default) ‘pchip’: Piecewise cubic Hermite interpolating polynomial—shape-preserving interpolation with smooth first derivative ‘cubic’: Cubic spline interpolation—smooth first and second derivatives throughout the curve | 
Examples
Determine the spectral bandwidth of the V(\lambda) curve:
lam = 380:780; VL = ciespec(lam,'VL'); sbw = specbandwidth(lam,VL)
See also: ciespec
Result:
swb = 100.39
Plot the spectral bandwidth for V(\lambda) at 75% peak height:
lam = 380:780;
VL = ciespec(lam,'VL');
threshold = 75;
[sbw,lam1,lam2] = specbandwidth(lam,VL,threshold);
% plotting
plot(lam,VL)
hold on
grid minor
plot([lam1 lam1 lam2 lam2],[0 threshold threshold 0]./100,'--k')
text(lam1+(lam2-lam1)/2,(threshold+5)./100,['bw = ',num2str(sbw),' nm'])
xlabel('$\lambda$ in nm')
ylabel('relative SPD')
hold off
texify
Result:

Determine the spectral bandwidth of the α-opic functions:
lam = 380:780; spec = ciespec(lam,'aopic'); sbw = specbandwidth(lam,spec)
See also: ciespec
Result:
sbw = 52.709 93.698 113.072 94.990 84.439
Determine the spectral bandwidth of the α-opic functions using ‘pchip’ interpolation:
lam = 380:780; spec = ciespec(lam,'aopic'); sbw = specbandwidth(lam,spec,50,'pchip')
See also: ciespec
Result:
sbw = 52.711 93.696 113.071 94.991 84.436