m1=53;
m2=62.096;
k=3.096e+006 ;
c=150;
disp('4 x 4 Mass matrix');
mt=[c,0,m1,0;0,0,0,m2;m1,0,0,0;0,m2,0,0];
disp('4 x 4 stiffness matrix');
kt=[-m1,0,0,0;0,m2,0,0;0,0,3*k,-2*k;0,0,-2*k,2*k];
Z=mt\kt;
[V,D]=eig(Z);
disp('Eigenvalues');
V;
disp('Initial conditions');
x0=[0;0;0.005;0];
disp('Integration constants');
S=V\x0;
tk=linspace(0,2,101);
x = zeros(numel(tk),2);
for k=1:101
t=tk(k);
for i=3:4
x(k,i-2)=0;
for j=1:4
x(k,i-2)=0;
x(k,i-2)=x(k,i-2)+(real(S(j))*real(V(i,j))-imag(S(j))*imag(V(i,j)))*cos(imag(D(j,j))*t);
x(k,i-2)=x(k,i-2)+(imag(S(j))*real(V(i,j))-real(S(j))*imag(V(i,j)))*sin(imag(V(i,j))*t);
x(k,i-2)=x(k,i-2)*exp(-real(D(j,j))*t);
end
end
end
plot(tk,x(:,1),'-',tk,x(:,2),':')
title('free vibration of a viscously damped 2 DOF')
xlabel('t[sec]')
ylabel('x(m)')
legend('x1(t)','x2(t)')
Best Answer