home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 6.ddi / CHEM.DI$ / PCRCAL.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.1 KB  |  33 lines

  1. function [fcal, f] = pcrcal(a, c, vc, n)
  2. % PCRCAL  Perform P-matrix type quant by cross-correlation 
  3. %
  4. %           PCRCAL does the P-matrix type quant by cross-correlation
  5. %           in the chosen abstract vector space.
  6. %
  7. %  fcal = pcrcal(a, c, vc, n)    or    [fcal, f] = fcalf(a, c, vc, n)
  8. %
  9. % Where:
  10. %
  11. %  fcal is the calibration matrix
  12. %  f    is the matrix containing the calibration in factor space
  13. %  a    is the absorbance matrix
  14. %  c    is the concentration matrix
  15. %  vc   is the matrix containing the factors (eigenvectors)
  16. %  n    is the number of factors to use in the calibration
  17. %
  18. % The concentrations of components in unknown spectra can be
  19. % calculated if the unknown absorbances are set up as a vector (for 1
  20. % unknown) or a matrix (for multiple unknowns).  The unknown matrix
  21. % can have any available name.  For example call it "u".  The 
  22. % unknown concentrations are then given by fcal * u.
  23. %
  24.  
  25. % Copyright (c) 1989-92 by The MathWorks, Inc.
  26.  
  27. [t, maxrank] = size(vc);
  28. if n > maxrank, n = maxrank, end;
  29. vc = vc(:, 1:n);
  30. proj = (vc' * a);
  31. f = c * proj' * inv(proj * proj');
  32. fcal = f * vc';
  33.