function macplot(haxes,realmodes1,realmodes2,lab1,lab2)
%
%  Name: macplot
% 
%  Usage: macplot(haxes,realmodes1,realmodes2,lab1,lab2)
%
%
% 
%   Description:
%     Plots the MAC of modal sets realmodes1 and realmodes2
%
%	

%  Version SWD970916
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This matlab source code was originally     %
% developed as part of "DIAMOND" at          %
% Los Alamos National Laboratory. It may     %
% be copied, modified, and distributed in    %
% any form, provided:                        %
%  a) This notice accompanies the files and  %
%     appears near the top of all source     %
%     code files.                            %
%  b) No payment or commercial services are  %
%     received in exchange for the code.     %
%                                            %
% Original copyright is reserved by the      %
% Regents of the University of California,   %
% in addition to Scott W. Doebling, Phillip  %
% J. Cornwell, Erik G. Straser, and Charles  %
% R. Farrar.                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


ndof = length(realmodes1{1});
nmodes1 = length(realmodes1);
nmodes2 = length(realmodes2);

Phi1 = zeros(ndof,nmodes1);
Phi2 = zeros(ndof,nmodes2);

for i = 1:nmodes1,
   Phi1(:,i) = realmodes1{i}';
end

for i = 1:nmodes2,
   Phi2(:,i) = realmodes2{i}';
end

%
%  Compute the MAC
%

MACPHI = mac(Phi2,Phi1)

%
%  Generate xfp and yfp
%

nmodplot1=size(Phi1,2);
nmodplot2=size(Phi2,2);

xvalues = [1:nmodplot1];
yvalues = [1:nmodplot2];
 
xfp=ones(length(yvalues),1)*xvalues;
yfp=yvalues'*ones(1,length(xvalues));

%
%  Draw the plot
%

bar3D(xfp,yfp,MACPHI,lab1,lab2,'MAC',-1,haxes);

set(haxes,'XLim',[0 nmodplot1+1],'Xtick',[1:nmodplot1],'YLim',[0 nmodplot2+1],...
   'Ytick',[1:nmodplot2],'Zlim',[0 1])
set(haxes,'box','on')
rotate3d on

return
