function [Nodes_def,nscale] = drawmode(Bars,Nodes,Shells,Phi,Freq,respDOF,nmod,isignmod,iundef,nscale,hageom,irescale,phsdel)
%
%  Name: drawmode
% 
%  Usage: drawmode(Bars,Nodes,Phi,Freq,respDOF,nmod)
% 
%   Description:
%	Draws displaced mode shape of mode number 'nmod'

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

%
%  Return Error if No Modes
%

if isempty(Phi) | isempty(Freq),
   disp(' ')
   disp('ERROR: Mode Shapes or Frequencies Missing from Workspace')
   disp(' ')
   return
end

if irescale~=1,
   %dar = get(hageom,'Dataaspectratio');
   %ax = axis;
end

if exist('phsdel')~=1,
   phsdel=0;
end

%
%  Clear the axes and draw the undef geom.
%

axes(hageom)

cla

if iundef == 1,
   updtgeom('--',[0 0 0],Nodes,Bars,Shells,hageom,14,[]);
end

if isignmod == 0,
    isign = 1;
else
    isign = -1;
end

Nodes_def = Nodes;

%
%
%  Determine 'Nodes' for displaced geometry
%
%

%
%  Loop over each entry in respDOF
%

for i = 1:size(respDOF,1),

%
%   Pull out the location, dir. magnitude, and dir. sign
%

    nloc = respDOF(i,1);
    ndirmag = abs(respDOF(i,2));
    ndirsign = sign(respDOF(i,2));

%
%   Find the Node which has this location
%

    rnode = find(Nodes(:,1) == nloc);

%
%   Make the appropriate change to this Node's Location
%

    Nodes_def(rnode,ndirmag+1) =  Nodes(rnode,ndirmag+1) + abs(Phi(i,nmod))*nscale*ndirsign*cos(phsdel+angle(Phi(i,nmod))-angle(Phi(1,nmod)));

end

%
%   Draw the deformed geometry
%

updtgeom('-',[0 0 0],Nodes_def,Bars,Shells,hageom,14,[]);

%
%   Add the Modal Frequency annotation
%

labstr = ['Mode Number: ',num2str(nmod),'       ',...
	'Frequency: ',num2str(Freq(nmod)),' Hz'];

ht = title(labstr);

set(ht,'fontweight','bold')
set(ht,'fontname','helvetica')
set(ht,'fontsize',10)

if irescale==1,

else
   %set(hageom,'Dataaspectratio',dar);
   %axis(ax)
end

return
