.


:




:

































 

 

 

 


procedure GrOfFunc;




Var

x,y,{ }

x1,x2, {[xl; x2] , }

y1,y2, {[yl; y2 ] }

dx, { }

mx,my:real; {}

l,b,{ }

h,w, { }

x0,y0:integer; //

function f (x:real):real;

Begin

f:=2*sin(x)*exp(x/5);

End;

Begin

l:=10;

b:= Form1.ClientHeight-20;

h:= Form1.ClientHeight-40;

w:=Form1.ClientWidth-40;

x1:=0;

x2:=25;

dx:=0.001;

y1:=f(x1);

y2:=f(x2);

x:=x1;

Repeat

y:=f(x);

if y<y1 then y1:=y;

if y>y2 then y2:=y;

x:=x+dx;

until (x>=x2);

my:=h/abs(y2-y1);

mx:=w/abs(x2-x1); //

x0:=l;

y0:=b-abs(round(y1*my));

With Form1.Canvas do

Begin

Moveto(l,b);

Lineto(l,b-h-13);

Moveto(x0,y0);

Lineto(x0+w,y0);

TextOut(l+5,b-h,FloatToStrF(y2,ffgeneral,6,3));

TextOut(l+5,b,FloatToStrF(y1,ffgeneral,6,3));

x:=x1;

Repeat

y:=f(x);

Form1.Canvas.Pixels[x0 + round(x*mx),y0

round(y*my)]:=clBlack;

x:=x+dx;

until (x>=x2);

End;

End;

 

4. GrOfFunc 䳿 OnPaintForm1. .

5. 䳿 OnCanResize ' Form1. , GrOfFunc :

With Form1 do

Canvas.FillRect(Rect(0,0, ClientWidth, ClientHeight));

GrOfFunc;

 

 

1. , , . ϳ .

ϳ. clGreen (Pen.Color:= clGreen) 䳿:

 

Font.Name:= arial';

Font.Size:= 10;

Textout(x0+5,y0+5, 'y=2*sin(x)*exp(x/5)');

Textout(x0+w-5,y0-8,'>');

Textout(x0+w-5,0+5,'X');

Textout(l-3,b-h-15,'^ Y');

clBlue Pixels.

 

2. , .

˳ :

Unit Unit1;

Interface

Uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs;

Type

...

Private

Public

End;

Var

Form1: TForm1;

Implementation

{$R *.dfm}

Procedure GrOfFunc;

{ GrOfFunc . }

End;

procedure TForml.FormPaint(Sender: TObject);

Begin

GrOfFunc; { GrOfFunc }

End;

procedureTForml.FormCanResize(Sender: TObject; var NewWidth,

NewHeight: Integer; var Resize: Boolean);

Begin

{ }

With Form1 do

Canvas.FillRect(rect(0,0, ClientWidth, clientHeight));

GrOfFunc;

End;

End.





:


: 2015-10-06; !; : 456 |


:

:

, .
==> ...

1721 - | 1509 -


© 2015-2024 lektsii.org - -

: 0.011 .