%Chapter 7, Fig 7.2 %Eric Dubois, updated 2018-12-12 %Plot spectral absorption and reflection curves %Data files should be placed in a data directory on the MATLAB path. clear all, close all; %read and interpolate the spectral absorption curve filterName = 'f807_darkLemon.txt'; absorp_in = dlmread(filterName,' '); %interpolate the absorption curve lami = 400:2:700; absorp = interp1(absorp_in(:,1),absorp_in(:,2),lami,'spline')'; figure; plot(lami,absorp,'k') xlabel('wavelength (nm)') axis([400 700 0 1]) xlabel('Wavelength (nm)'); ylabel('Normalized power'); title('Spectral transmission of dark lemon plastic filter'); set(gcf,'Color',[1 1 1]); set(gca,'fontname','times') %set the plot font to Times %Read the Macbeth data macbeth_spect = dlmread('specref.txt'); macsize = size(macbeth_spect); lam_mac = macbeth_spect(:,1); macbeth_yellow = interp1(lam_mac,macbeth_spect(:,17),lami,'spline'); figure; plot(lami,macbeth_yellow,'k'); xlabel('wavelength (nm)') axis([400 700 0 1]) xlabel('Wavelength (nm)'); ylabel('Normalized power'); title('Spectral reflectance of yellow square on a Macbeth Color Checker chart'); set(gcf,'Color',[1 1 1]); set(gca,'fontname','times') %set the plot font to Times