Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
70 1 и 2 часть.doc
Скачиваний:
1
Добавлен:
19.08.2019
Размер:
1.37 Mб
Скачать

Перечень ссылок

1.Бессонов Л.А. Теоретические основы электротехники. Электромагнитное поле.—М.: Высшая школа,1986.

2.Бессонов Л.А. Теоретические основы электротехники.—Л. Высшая школа,1972.

3.Татур Т.А. Основы теории электромагнитного поля: Справочное пособие.— М.: Высшая школа, 1989.

4.Методические указания к выполнению курсовой работы ”Расчет структуры электромагнитных полей” по курсу “Теория поля”.—Сумы: СумГУ,1997.

5.Бронштейн И.Н.,Семендяев К.А. Справочник по математике.—М.: Наука,1964.

Приложение а

программа для расчете и построения эквипотенциальных линий полей

#include<bios.h>

#include<stdlib.h>

#include<math.h>

#include<graphics.h>

const float a = 10,

E0 = 150000,

tau = 4e-8;

int hor, ver, but, in, scale = 20;

void ShowMouse()

{ asm { mov ax,1; int 033h } }

void StatusOfMouse()

{ asm { mov ax,3; int 033h; mov but,bx; mov hor, cx; mov ver,dx } }

void HideMouse()

{ asm { mov ax,2; int 033h } }

void MouseWindow()

{ asm { mov ax,8; mov cx,0029h; mov dx,0180h; int 033h } }

int MousePressed()

{ int fl_but;

asm { mov ax,3; int 033h; mov fl_but,bx }

if (fl_but) return 1; else return 0;

}

char *ftoa(float x,float digits)

{ char *p = 0; return gcvt(x,digits,p); }

void axes()

{

setcolor(RED); pieslice(320, 340, 0, 180, a*scale); setfillstyle(4, RED);

floodfill(322,338,RED); setcolor(YELLOW); line(0,340,640,340);

line(320,20,320,340);

outtextxy(30,350,"Left button - show coordinates; Right button - to draw" );

setcolor(WHITE); outtextxy(50,364,"+ SCALE -");rectangle(69,361,116,374);

outtextxy(325,30," -Z");

}

float potential(float x, float y)

{ float r=0, teta=0, Pt = 0;

r = sqrt(pow(x,2) + pow(y,2));

in = 0; if (r < a) in = 1; teta = asin(x/r);

// Cylinder

if (in == 1) Pt = 20;;

if (in == 0) Pt = E0*cos(teta)*(r+a*a/r)-tau*a/(2*M_PI*r);

// Sphere

// if (in == 1) Pt = 2*E0*r*cos(teta)*ee/(ei+2*ee);

// if (in == 0) Pt = E0*cos(teta)*(r + (a*a*a/r/r)*(-ei+ee)/(ei+2*ee));

return Pt;

}

int solve(float x, float y)

{ float P, a1, x1, y1, delta,eps, Pt;

moveto(320 + scale*x, 340 - scale*y);

P = potential(x,y);

int h = 1;

begin:

a1 = -1.57;

do { x1 = x + cos(a1); y1 = y + sin(a1);

a1 = a1 + 0.001; Pt = potential(x1,y1);

delta = (Pt - P); eps = Pt/100;

} while ( fabs(delta)>eps );

if ((scale*x1)<300 && (scale*y1)<300 && y1>0)

{ h++; if (h>100) return 0;

lineto(320 + scale*x1, 340 - scale*y1);

x = x1; y = y1; goto begin; }

else return 0;

}

void main()

{

int drv = 9, md = 2; float x_coo, y_coo;

initgraph(&drv,&md,"f:\\bcpp31\\bgi");

MouseWindow(); axes();

ShowMouse();

LP:

do { if (bioskey(1) == 283) { closegraph(); exit(0); }

if (bioskey(1) == 15104) { HideMouse(); cleardevice();

bioskey(0); axes(); ShowMouse(); }

} while (!MousePressed() );

setfillstyle(1,SOLID_FILL); bar(47,10,298,40); StatusOfMouse();

y_coo = (340 -(float)ver)/scale; x_coo = ((float)hor - 320)/scale;

if (ver>340 && hor<69 && scale<45) { cleardevice(); scale +=5; axes(); };

if (ver>340 && hor>116 && scale>5) { cleardevice(); scale -=5; axes(); };

HideMouse();

outtextxy(60,10,"X:");

outtextxy(170,10," Y: F1 - Clear Screen; ESC - Quit");

outtextxy(105,30,"Potential:");

outtextxy(87,10,ftoa(x_coo,5));

outtextxy(215,10,ftoa(y_coo,5));

outtextxy(215,30,ftoa(potential(x_coo,y_coo),5));

if (but==2) solve(x_coo, y_coo);

ShowMouse();

goto LP; }

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]