clear all
clc


%Lösung mit ode_45

F=5; %[N]
m1=1.1; %[kg]
m2=1.5; %[kg]
m3=10; %[kg]
c1=10; %[N/m]
c2=3.5; %[N/m]
c3=19.6; %[N/m]
c4=0.8; %[N/m]
w=1.4; %[1/s]

[t1,x1]=ode45(@(t1,x1)[x1(2);(F*cos(w*t1)-c1*x1(1))/m1],[0:0.1:20],[0;0]);
[t2,x2]=ode45(@(t2,x2)[x2(2);(F*cos(w*t2)-c4*x2(1)-c2*(x2(1)-x1(1)))/m2],[0:0.1:20],[0;0]);
[t3,x3]=ode45(@(t3,x3)[x3(2);(F*cos(w*t3)-c3*(x3(1)-x1(1)))/m3],[0:0.1:20],[0;0]);

 
subplot(2,1,1)  
plot(t1,x1(:,1),'k',t2,x2(:,1),'r',t3,x3(:,1),'g');
   grid;
   
subplot(2,1,2) 
plot(t1,x1(:,2),'k',t2,x2(:,2),'r',t3,x3(:,2),'g');
   grid;
   