home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* PLOTDEMO.PAS *)
- (* Demonstrationsprogramm für die Plotter-Units *)
- (* ------------------------------------------------------ *)
- program DEMO;
-
- uses
- HPGL, PLGRAPH;
-
- var
- f, x, y, x1, y1 : Vektor;
- xmin, xmax, ymin, ymax : real;
- n : word;
-
- function f1(x : real) : real;
- begin
- f1:= sin(2 * x) + 2 * cos(x);
- end;
-
- function f2(x : real) : real;
- begin
- f2 := 2 * cos(2 * x) - 2 * sin(x);
- end;
-
- procedure Beispiel1;
- var i : byte; a, b, dx : real;
- begin
- n := 50; a := -2*PI; b := 2*PI;
- dx:=(b-a)/(n-1); (* Werte berechnen *)
- for i := 1 to n do begin
- x[i] := a + ( i - 1) * dx; (* Funktion f1(x) *)
- y[i] := f1(x[i]);
- x1[i] := x[i]; (* Ableitung f2(x) *)
- y1[i] := f2(x[i]);
- end;
-
- OpenGraphik('PRN'); (* oder z.B.: 'C:Test.Dat' *)
-
- GraphikWindow(20, round(uAXmAX / 2 - 20 ),
- 20, round(vAXMAX / 2 - 20));
-
- Extrema(x, n, xmin, xmax);
- Extrema(y, n, ymin, ymax);
-
- Uscale(xmin, xmax, ymin, ymax, true, true, 5);
-
- XAxis(xmin, xmax, 'x', P_DefaultFont, P_FontSize);
- YAxis(ymin, ymax, 'f(x)', P_DefaultFont, P_FontSize);
-
- XGrid(0); Ygrid(0); XGrid(1); YGrid (1);
-
- Curve(x, y, n, P_NormalLn, P_NormStep, Yellow);
- Curvex(x, y, n, red);
-
- Curve(x1, y1, n, P_CenterLn, P_NormStep, LightRed);
- (* Curvex(x1, y1, n, red); *)
- end;
-
- begin
- Beispiel1;
- end.
- (* ------------------------------------------------------ *)
- (* Ende von PLOTDEMO.PAS *)
-