function [p] = qmatrix(a, c)
% QMATRIX  Calculate the Q-matrix calibration coefficients.
%
% Copyright (c) 1989-92 by The MathWorks, Inc.
%            QMATRIX calculates the Q-matrix calibration coefficients
%            for a given set of calibration mixtures.
%
%  qcal = qmatrix(a, c)
%
% Where:
%
%  qcal is the calibration matrix
%  a    is the absorbance matrix
%  c    is the concentration matrix
%
% The concentrations of components in unknown spectra can be calculated
% if the unknown absorbances are set up as a vector (for 1
% unknown) or a matrix (for multiple unknowns).  The unknown matrix 
% can have any available name.  For example call it "u".  The 
% unknown concentrations are then given by qcal * u.
%
%
%
% For more details, refer to pages 142 through 145 of the ASTM
% publication "Computerized Quantitative Infrared Analysis".
%
qcal = c * inv(a' * a) * a';
