Nugroho's blog.: Discrete Fourier Transform

## Friday, November 14, 2014

### Discrete Fourier Transform

It's not flexible one.

`unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls, Buttons, Grids;type  TForm1 = class(TForm)    StringGrid1: TStringGrid;    BitBtn1: TBitBtn;    Edit1: TEdit;    procedure proses;    procedure BitBtn1Click(Sender: TObject);    procedure FormCreate(Sender: TObject);  private    { Private declarations }  public    { Public declarations }  end;var  Form1: TForm1;implementation{\$R *.dfm}procedure tform1.proses;var i,j:integer;fm:real;begin  for i:=0 to 50 do begin    fm:=0;    for j:=0 to 10 do begin     {untuk fungsi rect(x)}     fm:=fm+1*cos(2*PI*j*i/10/11);    end;    stringgrid1.Cells[0,i+1]:=floattostr(i);    stringgrid1.Cells[1,i+1]:=floattostr(i/10);    stringgrid1.Cells[2,i+1]:=floattostr(fm);    edit1.Text:=floattostr(fm);    application.ProcessMessages;sleep(200);    f(x)=cos(x)+cos(2x)+cos(3x)+cos(4x)}  end;end;procedure TForm1.BitBtn1Click(Sender: TObject);begin  proses;end;procedure TForm1.FormCreate(Sender: TObject);begin  stringgrid1.RowCount:=51;  stringgrid1.Cells[0,0]:='no';  stringgrid1.Cells[1,0]:='m';  stringgrid1.Cells[2,0]:='f[m]';  //stringgrid1.Cells[3,0]:='no';end;end.`