function Gsyn = synFRF(Freq,Damp,phi_resp,phi_ref,fsyn,respDOF,refDOF)
%
%   Name: synFRF
%
%   Usage: Gsyn = synFRF(Freq,Damp,phi_resp,phi_ref,fsyn,respDOF,refDOF)
%
%   Description:Computes synthesized FRFs to overlay on data
%     
%
%     Freq = modal frequencies
%     fsyn = domain frequencies to synthesize
%     ireal = flag denoting real modes

%  Version SWD960920
%
%  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.)


nresp = size(phi_resp,1);
nref  = size(phi_ref,1);
nlines = length(fsyn);
nmod  = length(Freq);

wsyn = fsyn * 2 * pi;
wn   = Freq * 2 * pi;

j = sqrt(-1);

sig = -Damp .* wn;
wd = wn .* sqrt(1-Damp.^2);
pole = sig + j*wd;

Gsyn = zeros(nresp * nlines, nref);

for p = 1:nref,

   for s = 1:nresp,

      rk = phi_resp(s,:).' .* phi_ref(p,:).' ./ (2*j*wd) * sign(respDOF(s,2)) * sign(refDOF(p,2));

      gtemp = zeros(1,nlines);

      for i = 1:nmod,

	     gtemp = gtemp + (rk(i)./(j.*wsyn - pole(i)) +...
			 conj(rk(i))./(j.*wsyn - conj(pole(i)))) .* wsyn.^2 / 9.81; % ASSUMES ACCEL FRFs
	
	end

	Gsyn((s-1)*nlines+1 : s*nlines , p ) = gtemp.';

   end  

end

