-
Notifications
You must be signed in to change notification settings - Fork 1
/
fctform.pas
71 lines (56 loc) · 1.36 KB
/
fctform.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
unit FctForm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, TAGraph, TASeries,
BandPass, TADrawUtils, TACustomSeries, TATransformations;
type
{ TFunctionForm }
TFunctionForm = class(TForm)
Chart: TChart;
ChartAxisLgTransformation: TChartAxisTransformations;
ChartAxisLgTransformationLogarithmAxisTransform1: TLogarithmAxisTransform;
VoltageTransfer: TLineSeries;
VoltageTransferDQ: TLineSeries;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
public
LowPassFilter: TLowPassFilter;
end;
var
FunctionForm: TFunctionForm;
implementation
{$R *.lfm}
{ TFunctionForm }
procedure TFunctionForm.FormCreate(Sender: TObject);
const
N = 1000;
MIN = 1;
MAX = 2000;
var
i: Integer;
f, f0, U, U0, DQ: Double;
begin
LowPassFilter := TLowPassFilter.Create;
LowPassFilter.InstanceName := 'LowPassFilter';
for i := 0 to N - 1 do begin
f := MIN + (MAX - MIN) * i / (N - 1);
U := LowPassFilter.VoltageAmplitudeTransfer(f);
VoltageTransfer.AddXY(f, U);
if i = 0 then begin
f0 := 0;
U0 := U
end
else begin
DQ := (U - U0) / (f - f0);
VoltageTransferDQ.AddXY(f, DQ);
f := f0; U := U0
end;
end;
end;
procedure TFunctionForm.FormDestroy(Sender: TObject);
begin
LowPassFilter.Free
end;
end.