function [p] = pmatrix(a, c)
% PMATRIX  Calculate the P-matrix calibration coefficients.
%
% Copyright (c) 1989-92 by The MathWorks, Inc.
%
%            PMATRIX calculates the P-matrix calibration coefficients
%            for a given set of calibration mixtures.
%
%  p = pmatrix(a, c)
%
% Where:
%
%  p    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 p * u.
%
% For more details, refer to pages 141 and 142 of the ASTM 
% publication "Computerized Quantitative Infrared Analysis".
%
p = c * a' * inv(a * a');
