Select Optical Material for Optical System
This example shows how to select optical materials from the glass library and from optical materials in the workspace based on criteria such as refractive index, Abbe number, and supported wavelengths. For an interactive UI component for selecting optical materials, see opticalMaterialPicker.
Load Optical Materials
Create optical materials in the workspace.
om1 = opticalMaterial([1.673 35.56],Name="Glass1",WavelengthRange=[400 700]); om2 = opticalMaterial([1.613 36.28],Name="Glass2",WavelengthRange=[200 800]); om3 = opticalMaterial(Name="Glass3",RefractiveIndexMethod="Sellmeier",RefractiveIndexParameter=[1.1819 0.011313]);
Gather all optical materials in the workspace into an array of opticalMaterial objects.
workspaceVars = evalin("base","whos"); vars = workspaceVars(strcmp({workspaceVars.class},"opticalMaterial")); workspaceGlasses = []; for i = 1:numel(vars) currentGlass = evalin("base",vars(i).name); workspaceGlasses = [workspaceGlasses; currentGlass]; end
Load the glass library into the workspace.
gl = glassLibrary;
Specify Filtering Criteria
Specify the criteria for the refractive index (Nd) range, Abbe number (Vd) range, and supported wavelength range in which to filter optical materials from the glass library and from the workspace.
minNd =1.5; maxNd =
1.7; minVd =
35; maxVd =
37; minWavelength =
1; maxWavelength =
1000;
Filter Glass Materials
Filter the optical materials from the glass library to match the Nd range and Vd range by using the searchGlassLibrary function. You can also use a wavelength range criterion to filter optical materials from the glass library. Add a name hint filter criterion, as well. Inspect the table of filtered optical materials returned by the function.
glFiltered = searchGlassLibrary(NameHint="F2G",NdRange=[minNd maxNd],VdRange=[minVd maxVd])glFiltered=4×6 table
Name Catalog Nd Vd WavelengthRange Material
_______ ________ ______ ______ _______________ ___________________
"F2G12" "SCHOTT" 1.6207 36.56 400 2500 1×1 opticalMaterial
"F2" "SCHOTT" 1.62 36.37 320 2500 1×1 opticalMaterial
"F2" "HIKARI" 1.62 36.331 400 700 1×1 opticalMaterial
"F2" "CDGM" 1.6129 36.986 365 1014 1×1 opticalMaterial
Filter the optical materials in the workspace for the desired Nd range, Vd range, and supported wavelength range. Arrange the filtered materials in a table for better visualization. Inspect the table of filtered optical materials.
ndlist = vertcat(workspaceGlasses.Nd); vdlist = vertcat(workspaceGlasses.Vd); wlrlist = vertcat(workspaceGlasses.WavelengthRange); workspaceFilteredMaterials = workspaceGlasses(ndlist>=minNd & ndlist<=maxNd & vdlist>=minVd & vdlist<=maxVd & wlrlist(:,1)>minWavelength & wlrlist(:,2)<maxWavelength); names = [workspaceFilteredMaterials.Name]'; NdValues = [workspaceFilteredMaterials.Nd]'; VdValues= [workspaceFilteredMaterials.Vd]'; wavelengths = reshape([workspaceFilteredMaterials.WavelengthRange],2,[])'; workspaceFiltered = table(names,NdValues,VdValues,wavelengths,VariableNames=["Name","Nd","Vd","WavelengthRange"])
workspaceFiltered=2×4 table
Name Nd Vd WavelengthRange
________ _____ _____ _______________
"Glass1" 1.673 35.56 400 700
"Glass2" 1.613 36.28 200 800
Pick and Analyze Glass Materials
Pick the desired glass material from the glass library using the pickGlass function. Plot the refractive index of the selected glass material.
selectedGlass1 = pickGlass("F2G12"); lambdas = selectedGlass1.WavelengthRange(1):10:selectedGlass1.WavelengthRange(2); complexIndex = refractiveIndex(selectedGlass1,lambdas); Nd = real(complexIndex); k = imag(complexIndex); figure yyaxis left plot(lambdas,Nd) ylabel("Refractive Index (n_d)") yyaxis right plot(lambdas,k) ylabel("Extinction Coefficient (k)") xlabel("Wavelength (nm)")

Pick the desired glass material from the workspace. Plot the refractive index of the selected glass material.
selectedGlass2 = workspaceFilteredMaterials(2); lambdas = selectedGlass2.WavelengthRange(1):10:selectedGlass2.WavelengthRange(2); complexIndex = refractiveIndex(selectedGlass2,lambdas); Nd = real(complexIndex); k = imag(complexIndex); figure yyaxis left plot(lambdas,Nd) ylabel("Refractive Index (n_d)") yyaxis right plot(lambdas,k) ylabel("Extinction Coefficient (k)") xlabel("Wavelength (nm)")






