{$I DECL.TLD} {$I ARITH.TLD} {$I FOURIER.TLD} var x,y,a,b : RealArrayType_TL; n,i : integer; mini,maxi,y_int : real; begin clrscr; writeln('Beispiel einer Fourieranalyse mit anschliessender und Fouriersynthese'); writeln; write('Eingabe der Anzahl Datenpunkte : '); readln(n); for i:=1 to n do begin x[i]:=pred(i)*2.0*pi/pred(n); y[i]:=sin(x[i])+sin(5.0*x[i]); x[i]:=x[i]*3.0-1.0; end; writeln; writeln('Fourier-Analyse'); writeln; writeln(' k a[k] b[k] Betrag'); writeln; fourier_analysis(y,a,b,n); for i:=1 to n shr 1 do writeln(i:2,' ',a[i]:10:7,' ',b[i]:10:7,' ',sqrt(sqr(a[i])+sqr(b[i])):10:7); writeln; writeln('Fourier-Synthese'); writeln; mini:=min_real(x,n); maxi:=max_real(x,n); writeln(' i x[i] exakt Fourier-Synthese'); writeln; for i:=1 to n do begin y_int:=fourier_synthesis(x[i],a,b,n,mini,maxi); writeln(i:3,' ',x[i]:10:7,' ',y[i]:10:7,' ',y_int:10:7); end; end.