.


:




:

































 

 

 

 





"Ѳ" .

 

1. Ͳ ²Ҳ

 

1.1. , , , - ', , . . , , . , , . () .

1.2. I-

 

(1.1)

 

x - ;

y - .

 

y=g(x) x0 xk y0=y(x0). , , . , x0, Dx

 

xi+1 = xi + Dx = xi + H

 

i = 0, 1, 2... - ;

Dx=H - ,

 

yi+1 xi 1-

 

yi+1 = yi + f(xi, yi)

 

yi - ,

y0.

 

, yi+1 xi+1 yi () f(xi, yi) xi yi. , yi+1 - xi yi,

 

y = y + f(x, y) (1.2)

y = y +Dy

Dy - .

 

1.3. y=g(x) H, . 1.1.

 

 

. 1.1.

, , . , , , . 2, . 0,001 0,01, .

1.4. 1. I=f(t) L=1 R=10 U=220 .

 

(1.3)

 

t ( ).

 

(1.3) (1.1)

 

 

(1.2)

 

 

H , H=0,0001.

 

""

 

Program Euler;

Uses Crt;

Const

U= 220; L= 1; R= 10;

H= 0.0001; Tend= 1; Kprint= 50;

Var

I, t, Tprint:real;

 

Begin

{ }

TextBackGround (lightgray);

ClrScr;

TextColor (red);

writeln (' ':7, 'ղ ');

writeln;

TextColor (blue);

writeln (' ':9, ', ',' ':4,', ');

Window (1,4,80,25);

TextColor (white);

 

{ }

t:=0;

I:=0;

Tprint:=0;

 

Repeat

{ }

if t >= Tprint then

begin

writeln (' ':9,t:5:3,' ':5,I:7:3);

Tprint:= Tprint+ Kprint*H;

end;

{ }

I:= I+ H*(U-I*R)/L;

 

t:=t+ H;

Delay (50);

Until t > Tend+H;

 

Repeat Until KeyPressed;

End.

 

, , Kprint= 50.

 

"Ѳ" :

 

#include <stdio.h>

#include <conio.h>

#include <dos.h>

void main(void)

{

const float U=220, L=1, R=10, h=0.0001, Tend=1, Kprint=50;

float I,t,Tprint;

clrscr();

printf("\n\n%45s\n\n%27s%27s","Transient current","time,s","Current,A");

t=0;

I=0;

Tprint=0;

do

{

if(t>=Tprint)

{

printf("\n\n%28.5f%24.5f",t,I);

Tprint+=Kprint*h;

}

I+=h*(U-I*R)/L;

t+=h;

delay(3);

}

while(t<=Tend+h);

getch();

}

 

1.5. . 1- ( )

 

(1.4)

 

, 4- 4- 1-

 

(1.5)

 

y=y1, (1.5)

 

 

1.6. (1.4) , . .

1.7. 2. I=f(t) w=f(t) .

 

 

I , [];

w , [/];

t , [];

U=220 ;

=1,5 ;

R=0,5 ;

L=0,01 ;

J=0,8 *2 .

 

Y , N=2. Y[1]=I, Y[2]=w. F,

 

 

""

 

Program Euler_System;

Uses Crt, Graph;

Const

U= 220; L= 0.01; R= 0.5;

c= 1.5; H= 0.001; J= 0.8;

Tend= 1; N= 2; Kprint= 10;

Var

F, Y:array [1..N] of real;

Imax, Wmax, Tprint, t:real;

fn:text;

 

{ ϳ }

Procedure Euler;

Var

K:integer;

{ }

Procedure FY;

begin

F[1]:=(U-c*Y[2]-R*Y[1])/L;

F[2]:=c*Y[1]/J;

end;

Begin

{ }

TextBackGround (lightgray);

ClrScr;

TextColor (red);

writeln (' ':15, 'ղͲ ');

writeln;

TextColor (blue);

writeln (' ':2, ', ',' ':4,' ':4,', ',

' ':4,', /');

Window (1,4,80,25);

TextColor (white);

 

{ }

t:=0; Y[1]:=0; Y[2]:=0;

Imax:=0; Wmax:=0; Tprint:=0;

 

{ ³ }

Assign (fn, 'F:\TP\Demo.Out');

Rewrite(fn);

 

{ }

Repeat

{ }

if t >= Tprint then

begin

writeln (' ':3,t:5:2,' ':7,Y[1]:7:2,' ':7,

Y[2]:7:2);

writeln (fn, t:5:2,' ':7,Y[1]:7:2,' ':7, Y[2]:7:2);

Tprint:= Tprint+ Kprint*H;

if Y[1] > Imax then Imax:= Y[1];

if Y[2] > Wmax then Wmax:= Y[2];

end;

{ }

FY;

for K:=1 to N do Y[K]:=Y[K]+H*F[K];

Delay (500);

t:=t+ H;

Until t > Tend+H;

 

Window (1,1,80,25);

Close (fn);

End;

 

{ ϳ }

Procedure GRAPHIC;

Var

GraphDriver, GraphMode, ErrorCode:integer;

X, Yu, Yi, Yw, X0, Yu0, Yi0, Yw0, K:integer;

mt, mi, mw, I, W:real;

 

Begin

{ ³ }

GraphDriver:= Detect;

InitGraph (GraphDriver, GraphMode, 'f:\tp\bgi');

ErrorCode:= GraphResult;

if ErrorCode <> grOK then

begin

Writeln (GraphErrorMsg (ErrorCode));

Halt;

end;

{ }

SetBkColor(7);

Rectangle (40, 10, GetMaxX- 10, GetMaxY- 30);

for K:= 1 to 3 do Line (((GetMaxX- 40) div 4)*K+40, 10,

((GetMaxX- 40) div 4)*K+40, GetMaxY- 30);

for K:= 1 to 2 do Line (40, ((GetMaxY-30) div 3)*K,

GetMaxX-10, ((GetMaxY- 30) div 3)*K);

SetColor(red);

SetTextJustify (CenterText, CenterText);

SetTextStyle (SmallFont, HorizDir,5);

OutTextXY (35, GetMaxY-25,'0');

OutTextXY (GetMaxX-15, GetMaxY-25,'t');

SetColor(blue);

OutTextXY (20, 15,'I');

SetColor(magenta);

OutTextXY (20, 30,'W');

SetLineStyle (0,0,3);

{ }

mt:= (GetMaxX- 50)/Tend;

mi:= (GetMaxY- 40)/Imax;

mw:= (GetMaxY- 40)/Wmax;

{ }

X0:= 40;

Yi0:= GetMaxY- 30;

Yw0:= GetMaxY- 30;

{ ³ }

Assign (fn, 'F:\TP\Demo.Out');

Reset (fn);

{ }

While Not Eof(fn) do

begin

Readln (fn, t,I,W);

X:= 40+ Round (t*mt);

Yi:= GetMaxY- 30-Round (I*mi);

Yw:= GetMaxY- 30-Round (W*mw);

SetColor(blue);

Line (X0, Yi0, X, Yi);

SetColor(magenta);

Line (X0, Yw0, X, Yw);

X0:= X; Yi0:= Yi; Yw0:= Yw;

end;

 

Close (fn);

Repeat Until KeyPressed;

CloseGraph;

End;

 

{ }

BEGIN

Euler;

Graphic;

END.

 

"ѳ"

 

#include <stdio.h>

#include <conio.h>

#include <dos.h>

#include <graphics.h>

#include <math.h>

#define N 2

const float U=220, L=0.01, R=0.5, h=0.001, Tend=1, Kprint=10, c=1.5, J=0.8;

float Imax,Wmax,t,Tprint;

float mt,mi,mw;

int X0,Yi0,Yw0,X,Yi,Yw;

float F[N], Y[N];

int k;

int gd=DETECT, gm=0, errorcode;

FILE *pfile;

 

void main(void)

{

clrscr();

t=0;

Y[0]=0;

Y[1]=0;

Imax=0;

Wmax=0;

Tprint=0;

printf("\n\n%42s\n\n%17s%16s%16s\n\n","Transient speed and current","time,s","Speed rad/s","Current,A");

pfile=fopen("Cdemo.out","w");

do

{

if(t>=Tprint)

{

printf("%18.5f%14.5f%14.5f\n",t,Y[0],Y[1]);

fprintf(pfile,"%18.5f%14.5f%14.5f\n",t,Y[0],Y[1]);

Tprint+=Kprint*h;

if (Y[0]>Imax) Imax=Y[0];

if (Y[1]>Wmax) Wmax=Y[1];

}

F[0]=(U-c*Y[1]-R*Y[0])/L;

F[1]=c*Y[0]/J;

for(k=0;k<=1;k++) Y[k]+=h*F[k];

t+=h;

delay(1);

}

while(t<=Tend+h);

getch();

fclose(pfile);

initgraph(&gd, &gm, "C:\\TC\\BGI");

errorcode=graphresult();

if (errorcode!=grOk)

{

printf("Graphics error: %s\n:",grapherrormsg(errorcode));

printf("Press any key to exit");

getch();

exit(1);

}

rectangle(40,10,getmaxx()-10,getmaxy()-30);

for(k=1;k<=3;k++)

line(((getmaxx()-40)/4)*k+40,10,((getmaxx()-40)/4)*k+40,getmaxy()-30);

for(k=1;k<=2;k++)

line(40,((getmaxy()-30)/3)*k,getmaxx()-10,((getmaxy()-30)/3)*k);

outtextxy(35,getmaxy()-25,"0");

outtextxy(getmaxx()-15,getmaxy()-25,"t");

setcolor(RED);

outtextxy(20,15,"I");

setcolor(MAGENTA);

outtextxy(20,30,"W");

mt=(getmaxx()-50)/Tend;

mi=(getmaxy()-40)/Imax;

mw=(getmaxy()-40)/Wmax;

X0=40;

Yi0=getmaxy()-30;

Yw0=getmaxy()-30;

setlinestyle(SOLID_LINE,0xFFFF,THICK_WIDTH);

pfile=fopen("Cdemo.out","r");

while(!feof(pfile))

{

fscanf(pfile,"%f%f%f\n",&t,&Y[0],&Y[1]);

X=40+(t*mt);

Yi=getmaxy()-30-(Y[0]*mi);

Yw=getmaxy()-30-(Y[1]*mw);

setcolor(MAGENTA);

line(X0,Yw0,X,Yw);

setcolor(RED);

line(X0,Yi0,X,Yi);

X0=X;

Yi0=Yi;

Yw0=Yw;

}

getch();

closegraph();

fclose(pfile);

}

 

2.

 

"Ѳ", .

2.1. ҳ 䳺 .

; V ; g ; K=0,5 ; t .

x=f(t), V=f(t) 0 5 .

2.2.

jA, jB ; U=10 ; a=2, c=3 ; =0,5 , =0,8 ; t .

jA=f(t), jB=f(t) 0 3 .

2.3. 璺 , , ,

; U ; =100 ; R=100 ; L=0,01 ; =1 ; t .

=f(t), U=f(t) U.

2.4.

V, ; U=100 ; =2 ; t .

V=f(t), =f(t) 0 10 .

2.5.

; N ; =1000 ; =40, =80 ; k=10 ; t .

=f(t), N=f(t) 0 10 .

2.6. .

; U ; U=10 ; R=0,5 ; L=0,01 ; =3 ; t .

=f(t), U=f(t) 0 4 .

2.7. ҳ 䳺 V0=0,5 / 0=2 .

; V ; t .

x=f(t), V=f(t) .

2.8.

; w ; R=0,5 ; L=0,01 ; =2 ; J=0,2 *2 ; t .

=f(t), w=f(t) w0=90 / 0=-50 .

2.9.

1, 2 ; =3000 ; 1=2, 2=3 ; 1=10, 2=15 ; t .

1=f(t), 2=f(t) 0 30 .

2.10. ,

w, j ; U=220 ; k=0,5 ; =0,5 ; t .

w=f(t), j=f(t) 0 3 .

 

3. Ͳ

 

3.1. .

3.2. .

3.3. .

3.4. 1- .

3.5. 1- .


 

ί ˲

 

1. .., .., .. .- : , 1991.- 365 .

2. 7.0.- .: BHV, 1996.- 448 .

3. .. Turbo Pascal.- .: , 1995.- 352 .

4. .., .. .- .: , 1981.- 718 .

5. 3008-95. . . .- .: , 1995.- 38 .

6. ., . .\ . ., 3- ., . .: , 2001. 352 .

7. .., .. : . . 2- . . .: , 2004. 600 .

 


 

̲Ͳ ² , IJ

 

 

Ͳ ² "". 1

 

' 2 -1

 

.. -01

..

 

 

2011


 

ٲ TURBO PASCAL 7.0 TURBO C 3.0

 

ϳ TURBO PASCAL 7.0 turbo.exe ' , :

1) : F ile, E dit, S earch, R un, C ompile, D ebug, T ools, O ptions, W indow, H elp. : F10 , , Alt , , , Alt-F. ³ Esc;

2) ( ), , ;

3) - , 䳿 , . .

 

 

: , , , .

F ile/ N ew.

 

 

NONAME00.PAS, 00 ( .PAS ). , . . ˳ , . . , , 1:1.

 

 

ϳ F ile/ S ave  F2. ' , , Code. Enter. .PAS .

 

 

, F ile/Change dir.

 

 

E dit Copy Cut Paste . Shift .

 

 

F ile/ O pen. F iles Open.

 

 

ϳ C ompile/ C ompile Alt-F9. ' ' .EXE. C ompile/ D estination Memory Disk.

 

, , ( ) .

 

 

ϳ R un/Run Ctrl-F9. , .

R un/Step Over F8. ϳ . . 䳺 R un/Trace Into ( F7), . , R un/Go to cursor ( F4). R un/Program reset ( Ctrl-F2).

 

 

, D edug/User screen ( Alt-F5).

 

 

D edug/Breakpoints. ϳ Edit Condition , , >=0. Pass count. File Name ' () , Line number , .

 

 

ϳ , Debug/Watch. Debug/Add watch. Window/Tile.

 

 

Turbo Pascal 7.0 F ile/Quit Alt-X.

Ѳ TURBO C 3.0 .

 

 


̲

 

.......................................................................................................... 3

' 1. ASCII........... 4

' 2. ""..... 9

' 3. "".................... 16

' 4. ϳ ""......... 27

' 5.

""................................................................................................. 40

' 6.

""................................................................................................ 50

' 7.

""................................................................................................. 67

' 8. ""....... 74

' 9. '-

"".................................................................................... 91

' 10.

ѳ................................................................................. 101

11.

"ѳ"............................................................................................ 111

12. "ѳ"...... 116

13.

"ѳ"............................................................................................ 123

14. , ,

"ѳ"............................................................................... 129

15. ѳ................................................................................................................ 137

16. ѳ.... 147





:


: 2016-10-22; !; : 483 |


:

:

- , 20 40 . - .
==> ...

1633 - | 1590 -


© 2015-2024 lektsii.org - -

: 0.242 .