function mc=mac(t1,t2,Q)
%
%   mac
%
%   Computes modal assurance criteria 
%
%
%   mc=mac(phi1,phi2)
%
%
[ns,n]=size(t1);[ns1,n1]=size(t2);
ns=min([ns,ns1]);
if nargin < 3, Q=eye(ns,ns); end
t1=t1(1:ns,:);t2=t2(1:ns,:);mc=zeros(n,n1);
for i=1:n,
  for j=1:n1,
    mc(i,j)=(t1(:,i)'*Q*t2(:,j))^2/(t1(:,i)'*Q*t1(:,i)*t2(:,j)'*Q*t2(:,j));
  end
end
return
