⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 realft.dem

📁 Delphi Pascal 数据挖掘领域算法包 数值算法大全
💻 DEM
字号:
PROGRAM d12r3(input,output);
(* driver for routine REALFT *)
LABEL 1,99;
CONST
   eps=1.0e-3;
   np=32;
   np2=34;   (* np+2 *)
   width=50.0;
   pi=3.1415926;
TYPE
   gldarray = ARRAY [1..np2] OF real;
VAR
   big,per,scal,small : real;
   i,j,n,nlim : integer;
   data,size : gldarray;

(*$I MODFILE.PAS *)
(*$I FOUR1.PAS *)

(*$I REALFT.PAS *)

BEGIN
   n := np DIV 2;
1:   writeln('Period of sinusoid in channels (2-',np:2,')');
   readln(per);
   IF (per <= 0.0) THEN GOTO 99;
   FOR i := 1 to np DO BEGIN
      data[i] := cos(2.0*pi*(i-1)/per)
   END;
   realft(data,n,+1);
   big := -1.0e10;
   FOR i := 1 to n DO BEGIN
      size[i] := sqrt(sqr(data[2*i-1])+sqr(data[2*i]));
      IF (size[i] > big) THEN big := size[i]
   END;
   size[1] := data[1];
   IF (size[1] > big) THEN big := size[1];
   scal := width/big;
   FOR i := 1 to n DO BEGIN
      nlim := round(scal*size[i]+eps);
      write(i:4,' ');
      FOR j := 1 to nlim+1 DO write('*');
      writeln
   END;
   writeln('press RETURN to continue ...');
   readln;
   realft(data,n,-1);
   big := -1.0e10;
   small := 1.0e10;
   FOR i := 1 to np DO BEGIN
      IF (data[i] < small) THEN small := data[i];
      IF (data[i] > big) THEN big := data[i]
   END;
   scal := width/(big-small);
   FOR i := 1 to np DO BEGIN
      nlim := round(scal*(data[i]-small)+eps);
      write(i:4,' ');
      FOR j := 1 to nlim+1 DO write('*');
      writeln
   END;
   GOTO 1;
99:
END.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -