%
disp(' ');
disp(' mass_stiffness_assembly.m  ver 1.1  Feb 16, 2010');
disp(' by Tom Irvine ');
%
disp(' Assemble mass and stiffness matrices using transformation matrices. ');
%
clear KG;
clear MG;
%
disp(' ');
disp(' Enter total dof ');
n=input(' ');
KG=zeros(n,n);
MG=zeros(n,n);
%
disp(' ');
disp(' Enter number of systems ');
ns=input(' ');
%
for(i=1:ns)
    clear m;
    clear k;
    clear t;
    out1=sprintf('\n Enter system %d mass matrix name ',i);
    disp(out1);
    m=input(' ');
    out1=sprintf('\n Enter system %d stiffness matrix name ',i);
    disp(out1);
    k=input(' ');
    out1=sprintf('\n Enter system %d transformation matrix name ',i);
    disp(out1);   
    t=input(' ');
%
    KG=KG+(t'*k*t);
    MG=MG+(t'*m*t);
%
end
%
MG
KG
%
[fn,omega,ModeShapes,MST]=Generalized_Eigen(KG,MG,1);