mw=1813;
mt=2615;
mc=1813;
jc=1970000;
jt=1476;
k1=1220;
k2=1220;
c1=4;
c2=32;
lt=7.45;
lw=0.8;
M=zeros(10);
M(1,1)=1813;
M(2,2)=1970000;
M(3,3)=2615;
M(4,4)=1476;
M(5,5)=2615;
M(6,6)=1476;
M(7,7)=1813;
M(8,8)=1813;
M(9,9)=1813;
M(10,10)=1813;
C=[(2*c2),0,-c2,0,-c2,0,0,0,0,0;
    0,(2*c2*lt),0,-c2*lt,0,-c2*lt,0,0,0,0;
    -c2,0,(c2+2*c1),0,0,0,-c1,-c1,0,0;
    0,0,0,2*c1*lw,0,0,-c1*lw,-c1*lw,0,0;
    -c2,0,0,0,(2*c1+c2),0,0,0,-c1,-c1;
    0,0,0,0,0,2*c1*lw,0,0,-c1*lw,-c1*lw;
    0,0,-c1,-c1*lw,0,0,c1,0,0,0;
    0,0,-c1,-c1*lw,0,0,0,c1,0,0;
    0,0,0,0,-c1,-c1*lw,0,0,c1,0;
    0,0,0,0,-c1,-c1*lw,0,0,0,c1]*1000;
K=[(2*k2),0,-k2,0,-k2,0,0,0,0,0;
    0,(2*k2*lt),0,-k2*lt,0,-k2*lt,0,0,0,0;
    -k2,0,(k2+2*k1),0,0,0,-k1,-k1,0,0;
    0,0,0,2*k1*lw,0,0,-k1*lw,-k1*lw,0,0;
    -k2,0,0,0,(2*k1+k2),0,0,0,-k1,-k1;
    0,0,0,0,0,2*k1*lw,0,0,-k1*lw,-k1*lw;
    0,0,-k1,-k1*lw,0,0,k1,0,0,0;
    0,0,-k1,-k1*lw,0,0,0,k1,0,0;
    0,0,0,0,-k1,-k1*lw,0,0,k1,0;
    0,0,0,0,-k1,-k1*lw,0,0,0,k1]*1000;
R=(mc+2*mt+4*mw)*9.81/4;
F=[mc*9.81;0;mt*9.81;0;mt*9.81;0;mw*9.81-R;mw*9.81-R;mw*9.81-R;mw*9.81-R];
[X,e,s]=polyeig(K,C,M);
w=zeros(20);
for i=1:20
w(i,i)=e(i);
end
x=linspace(0,10,1000);
for i=1:20
    mode(:,i)=exp(w(i,i).*x);
end
q = figure ;
%
% Plotting mode shape
for i=1:20
subplot(4,5,i);
plot(x,mode(:,i),'-b','linewidth',1) ;
h = w(i,i) ;
title(num2str(h));
axis auto;
xlabel('time');
ylabel('displacement');
hold on; 
end
hold off;