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

  1. function [regen, resid] = pcrregen(a, vc, n)
  2. % PCRREGEN   Calculate short circuit reproduction and residuals for absorbance matrix.
  3. %
  4. %          PCRREGEN caluclates the short ciruit reporduction and
  5. %          residuals for an absorbance matrix based on the number
  6. %          of factors.
  7. %  regen = pcrregen(a, vc, n)    or    [regen, resid] = pcrregen(a, vc, n)
  8. %
  9. % Where:
  10. %
  11. %  regen is the matrix containing the regenerated data
  12. %  resid is the matrix containing the residuals of the regeneration
  13. %  a     is the absorbance matrix
  14. %  vc    is the matrix containing the factors
  15. %  n     is the number of factors to use in the regeneration
  16. %
  17.  
  18. % Copyright (c) 1989-92 by The MathWorks, Inc.
  19.  
  20. [t, maxrank] = size(vc);
  21. if n > maxrank, n = maxrank, end;
  22. vc = vc(:, 1:n);
  23. regen = (a' * vc * vc')';
  24. resid = a - regen;
  25.