Code covered by the BSD License  

Highlights from
Method for quantitative absorption spectroscopy, version 2.1

image thumbnail

Method for quantitative absorption spectroscopy, version 2.1



14 Aug 2006 (Updated )

A computational method for quantitative analysis by multiwavelength absorption spectroscopy

% Interactive explorer for measuring absorbance from instrumentally-broadened 
% transmission profiles. Compares single-wavelength, Regression, 
% and TransFit methods. Simulates photon noise and uinabsorbed straylight.
% You can adjust these input variables in lines 33-39:
%    ArrayLength     Number of points in data array (initially =100)  
%    width           Width of absorption peak (initially =10)   
%    InstWidth       Width of instrument function (spectral bandpass) (initially =10)
%    absorbance      True absorbance of analyte at the peak center, without
%                    instrumental broadening or stray light effects.
%    noise           Random noise level (initially 0.005)
%    straylight      Fractional unabsorbed stray light. May be a constant or a 
%                    array of stray light values at each wavelength. (initially 0.005)
% y = true transmission spectrum, without noise or broadening
% a = instrument function
% yobsd = noisy instrumentally broadened spectrum
% f = frequency coordinate vector
% x = wavelength coordinate vector
% Required functions:
% gaussian, lorentzian, FMINSEARCH, fitLorTc, rtslid
% CalculateTfit, Redraw, TFitSliders1,2,3,4,and 5
% Example: just type DemoTFit in the command window.
% Tom O'Haver (, August 2006.  Slider function by Matthew Jones.
global x y z InstFunction c width absorbance InstWidth
global straylight noise NoiseArray IzeroShift
format compact

% Initial values of the user-adjustable parameters:
ArrayLength=100;  % Number of points in data arrays (typically 50 - 1000)
absorbance=1;  % True absorbance of analyte at peak center (Slider adjustable)
width=ArrayLength/10; % FWHM of absorption peak  (Slider adjustable)
InstWidth=ArrayLength/10; % FWHM of broadening function (Slider adjustable)
noise=0.05;  % Random noise level when InstWidth = 1 (Slider adjustable)
straylight=.005; % May be a scalar or a vector of length ArrayLength (Slider adjustable)
IzeroShift=.005; % Random shifts in the 100% T intesity due to backgrouond absorption

% Calculate and plot graph for the initial conditions
x=[1:ArrayLength]';  % X-axis vector to serve as a wavelength or wavenumber axis.
% Perform calculations and plot initial graphs 
h2=gca;axis([1 ArrayLength 0 1.1]);

% Draw the sliders and set the slider ranges, labels, initial positions, and
% associated functions.
rtslid(h,@TFitSliders1,h2,1,'Scale',[-3 2],'Def',log(absorbance),'Back',[0.9 0.9 0.9],'Label','Peak A');
rtslid(h,@TFitSliders2,h2,0,'Scale',[1 ArrayLength/5],'Def',InstWidth,'Back',[0.9 0.9 0.9],'Label','InstWidth','Position',[0.94 0.53 0.03 0.17]);
rtslid(h,@TFitSliders3,h2,0,'Scale',[1 ArrayLength/5],'Def',width,'Back',[0.9 0.9 0.9],'Label','AbsWidth','Position',[0.94 0.78 0.03 0.17]);
rtslid(h,@TFitSliders4,h2,0,'Scale',[0 .1],'Def',straylight,'Back',[0.9 0.9 0.9],'Label','straylight','Position',[0.94 0.28 0.03 0.17]);
rtslid(h,@TFitSliders5,h2,1,'Scale',[0 .1],'Def',noise,'Back',[0.9 0.9 0.9],'Label','Noise','Position',[0.94 0.03 0.03 0.17]);

Contact us