function [phin_resp,phin_ref] = unmnorm(phir_resp,phir_ref)
%
%  Name: unmnorm
% 
%  Usage: [phin_resp,phin_ref] = unmnorm(phir_resp,phir_ref)
% 
%   Description:
%     Executes mass-normalization of mode shapes
%     using a unit mass matrix
%

%  Version SWD970519
%
%  Author(s): Scott W. Doebling, doebling@lanl.gov
%
%  Institution: Los Alamos National Laboratory,
%		ESA-EA
%
%  Copyright (c) 1997, The Regents of the University
%     	of California. (See top level of code for
%	full copyright statement.)

unitM = eye(size(phir_resp,1));

m_mass = diag(phir_resp' * unitM * phir_resp);

phin_resp = zeros(size(phir_resp));
phin_ref  = zeros(size(phir_ref));

for i = 1:size(phir_resp,2),

   phin_resp(:,i) = phir_resp(:,i) / sqrt(m_mass(i));
   phin_ref(:,i)  = phir_ref(:,i)  * sqrt(m_mass(i));

end

return
