function [phin_resp,phin_ref] = DPnorm(dppair,phir_resp,phir_ref)
%
%  Name: DPnorm
% 
%  Usage: [phin_resp,phin_ref] = DPnorm(dppair,phir_resp,phir_ref)
% 
%   Description:
%     Executes mass-normalization of mode shapes
%     based on a single driving point FRF
%

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

nmod = size(phir_resp,2);

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

%
%  Check size of dppair
%

if size(dppair) ~= [1 2],

    disp('ERROR: Driving Point Pair must be Vector of size 1 x 2')
    return

end

respdp = dppair(1);
refdp  = dppair(2);

%
%  Make sure Reference mode shapes are signed so that the DP MPF is positive
%

%for i = 1:size(phir_ref,2),

%    phir_ref(:,i) = phir_ref(:,i) * sign(phir_ref(refdp,i) * phir_resp(respdp,i));

%end


%
%  Compute normalized driving-point value at respdp (refdp) for each mode
%

normval = sqrt(abs(phir_resp(respdp,:).*phir_ref(refdp,:)));

%
%  Compute normalized values at all other DOF using dp as reference value
%

for i = 1:nmod,

    phin_resp(:,i) = phir_resp(:,i) / abs(phir_resp(respdp,i)) * normval(i);
    phin_ref(:,i) = phir_ref(:,i) / abs(phir_ref(refdp,i)) * normval(i);

end


return
