Текст програми.
Program mzkt;
uses crt;
label 1, 2;
const E=6; tau1=1; tau2=5; T=10.0; n=20; Ut0=0;
var fajl : Text;
omega, dt, te : real;
C, B, A, fi, Ut, f : array[1..n] of real;
z1, z2, Wser : real;
i, k : integer;
Begin
clrscr;
Assign(fajl, 'D:\Docs\mzktpp.txt');
rewrite(fajl);
omega:=2*pi/T;
for i:=1 to n do f[i]:=i/T;
for k:=1 to n do
begin
z1:=(1.0/(k*omega*tau1))*(cos(k*omega*tau1)-1);
z2:=sin(k*omega*(tau1+tau2));
C[k]:=(E/(k*pi))*(z1+z2)
end;
for k:=1 to n do
begin
z1:=(1.0/(k*omega*tau1))*sin(k*omega*tau1);
z2:=cos(k*omega*(tau1+tau2));
B[k]:=(-1.0*E/(k*pi))*(z1+z2)
end;
for k:=1 to n do
begin
A[k]:=sqrt(sqr(C[k])+sqr(B[k]));
fi[k]:=arctan(B[k]/C[k])
end;
Wser:=0;
for k:=1 to n do Wser:=Wser+sqr(A[k]);
Wser:=1.0/2.0*Wser;
for i:=1 to n do writeln(fajl, i, 'f=',f[i]);
writeln(fajl,'');
for k:=1 to n do writeln(fajl,'C',k,'=',C[k]);
writeln(fajl,'');
for k:=1 to n do writeln(fajl,'B',k,'=',B[k]);
writeln(fajl,'');
for k:=1 to n do writeln(fajl, 'A',k,'=',A[k]);
writeln(fajl,'');
for k:=1 to n do writeln(fajl, 'fi',k,'=',fi[k]);
writeln(fajl,'');
writeln(fajl,' Wser=',Wser);
dt:=1.0*T/n;
te:=0;
k:=1;
1: te:=te+dt;
if te>T then goto 2;
Ut[k]:=0;
for i:=1 to n do Ut[k]:=Ut[k]+C[i]*cos(i*omega*te)+B[i]*sin(i*omega*te);
k:=k+1;
goto 1;
2: writeln(fajl,'');
te:=0;
for i:=1 to n do
begin
te:=te+dt;
writeln(fajl,'U(t=',te:4:2,')= ',Ut[i])
end;
writeln(fajl,'');
writeln(fajl,' END');
close(fajl)
end.
Графіки.