Uses crt, graphABC;
Const r=0.1; k=0.01; dt=0.001; q=100; N=60;
Var teta,F,t,m: real; i,Gd,Gm: integer;
eta,ksi: array[0..N+1] of real;
Procedure Oscillator;
begin
F:=q*(ksi[i-1]-ksi[i])+q*(ksi[i+1]-ksi[i]);
If i>N/2 then m:=1 else m:=0.3;
teta:=(F-r*eta[i]-k*ksi[i])/m;
eta[i]:=eta[i]+teta*dt;
ksi[i]:=ksi[i]+eta[i]*dt;
end;
BEGIN
Repeat t:=t+dt;
For i:=1 to N do
begin
Oscillator;
If 5*t<3.142 then
ksi[1]:=10*sin(5*t)
else ksi[1]:=0; ksi[N]:=0; {ksi[N]:=ksi[N-l]; }
end;
clrScr;
For i:=1 to N do circle(8*i,240-round(ksi[i]*10),2);
until KeyPressed;
END.