Страница: 9/9
procedure write_shift;
var i, j, k : word;
z : real;
shift : array[1..30] of real;
f : text;
begin
assign(f,'treck.txt');
rewrite(f);
for j:=1 to 30 do shift[j]:=0;
j:=2;
repeat
j:=j+1;
write(f,j:3);
for i:=1 to 30 do
with cell[i] do
begin
z:=sqrt((x[j]-x[j-1])*(x[j]-x[j-1])+(y[j]-y[j-1])*(y[j]-y[j-1]));
shift[i]:=shift[i]+z;
write(f,shift[i]:9:2);
end;
writeln(f);
until j=100;
close(f);
end;
procedure write_angle;
var i, j, k : word;
z : real;
shift : array[1..30] of real;
f : text;
begin
assign(f,'angle.txt');
rewrite(f);
with step_distri[angle] do
for j:=0 to 10 do writeln(f,step[j]:10:2,cent[j]:10,cummulate[j]:10);
close(f);
end;
procedure write_disp;
var i, j, k : word;
z : real;
shift, loc_calc : array[1..30] of real;
f : text;
begin
assign(f,'disper.txt');
rewrite(f);
for j:=1 to 30 do begin loc_calc[j]:=0; shift[j]:=0; end;
j:=1;
repeat
j:=j+1;
write(f,ln(j):10:2);
for i:=1 to 30 do
with cell[i] do
begin
loc_calc[i]:=0;
for k:=j+1 to 100 do
begin
z:=(x[k]-x[k-j])*(x[k]-x[k-j])+(y[k]-y[k-j])*(y[k]-y[k-j]);
loc_calc[i]:=loc_calc[i]+z;
end;
shift[i]:=loc_calc[i]/(100-j);
write(f,0.5*ln(shift[i]):10:2);
end;
writeln(f);
until j=98;
close(f);
end;
procedure write_distr;
var i, j, k : word;
z : word;
shift : array[0..35] of word;
f : text;
begin
assign(f,'dist_sp.txt');
rewrite(f);
for j:=0 to 35 do shift[j]:=0;
for i:=1 to 30 do
with cell[i] do
begin
for j:=2 to 100 do
begin
z:=round(sqrt((x[j]-x[j-1])*(x[j]-x[j-1])+(y[j]-y[j-1])*(y[j]-y[j-1])));
shift[z]:=shift[z]+1;
end;
end;
for j:=0 to 30 do writeln(f,j:3,shift[j]:10);
close(f);
end;
procedure draw_cell(c : cell_typ; x, y : real);
var
color, graph_x, graph_y : integer;
begin
case c of
slow : color:=lightcyan;
mean : color:=yellow;
fast : color:=white;
end;
graph_x:=round(x*n_pix_inline/2000);
graph_y:=round(y*n_line/2000);
putpixel(graph_x,graph_y,color);
end;
procedure draw_picture;
var
i,j : word;
begin
for i:=1 to 30 do
with cell[i] do
for j:=1 to 100 do
begin
draw_cell(speed,x[j],y[j]);
end;
end;
begin
randomize;
init;
make_all_steps;
speed_meas;
write_shift;
write_distr;
write_disp;
write_angle;
opengraph;
draw_picture;
key:=readkey;
closegraph;
end.
Реферат опубликован: 23/05/2005 (31474 прочтено)