Вы находитесь на странице: 1из 119

..

.............................................................................................................. 1
1. ............................................ 5
1.1. ........................................................................... 6
1.1.1. ................................................................................ 6
1.1.2. .............................................................................. 9
1.2. ....................................................................... 11
1.2.1. ........................................................... 12
1.2.1. ................................................................. 13
1.3. ..................................................................... 15
1.3.1. ............................................................................. 15
1.4. ....... 16
1.4.1. ............................................. 17
1.4.2. .......................................................................................... 18
1.4.3. ............................................................................. 20
2. .................................................. 22
2.1. .................................................................................... 23
2.2. .................................................................................... 25
3.

............................................ 25
3.1. ....................................................................... 26
3.1.1. - ............................................................... 26
3.1.2. , ....................... 27
3.2. ...................................................................... 31
3.2.1. ...................................... 31
3.2.2. ...................................................... 37
4. ..... 39
4.1. .......... 39
4.1.1. ................................................................. 40
4.1.2. LU-....................................................................... 42
4.1.3.

.................................................................. 44
4.2. ...... 55
4.2.1. ......................................................... 56
4.2.2. - ................................................................. 61
5.
MATLAB........................................................................................ 66
5.1. .................................................. 66
5.1.1.

............................................................................ 67
5.1.2.
............................................................................................. 73
5.1.3.
............................................................................................ 83

3
5.2. ................................... 91
5.3. ............................................... 104
................................................................................................... 118
..................................................................................................... 119


.
()
, . ,
, , () .
, ,

,
.
, .
. , .
, .
, , ,
, , , ,
, , ,
, .
MATLAB ,
.
, [1 - 4]. -
,
.

5
1.


( ), , , ,
, , .
,
. , , , ,
.
n

u +
u + C(x)
A (x)
B (x)
u
x x
x
2

, =1

=1

f (x) ,

(1)

x = [x1, x2, xn] (-) 1; u


; A(x), B(x), C(x), f(x)
[1, 2].
(1)
. A(x) , x. ,

x, y,

u
A ( x, y)
x
2

xx

+ Bx ( x, y)

u
+ A ( x, y)
x y
2

xy

u
+ A ( x, y)
y
2

u + ( x, y) u + C( x, y)
u
B
x
y
y

yy

+
,

(2)

f ( x, y)

,
D( x, y) = A2xy ( x, y) 4 Axx( x, y) Ayy ( x, y) .

(3)

D(x, y) < 0,
(x, y).
D(x, y) = 0,
(x, y).

6
D(x, y) > 0,
(x, y).
Axx, Axy, Ayy D x,
y, D ,
[1].
1.1.
, .
1.1.1.
, .. ,
( ) [2], (x, y, z) :

u
x
2

+ u
y
2

+ u
z
2

=0 ,

(4)

u = u(x, y, z) .
(4)
:
(5)
u = 0 ,
= + +
x y z
2

- .

V, S
X = (x, y, z).
,
W = (x, y, z) [1]:
(6)
W = k grad (T) ,
k = k(x, y, z) .
,
[1].
,
(x, y, z) f(x, y, z). f(x, y, z) (6),
.
,
QS, -

7
S, V,

(7)
QS = W dS ,
S

dS , dS , ; WdS = WdScos() W dS; - .


QV,
V, S,
(8)
QV = f ( x, y, z) dV .
V

,
QS,
S, V, QV,
:
(9)
W dS = f ( x, y, z) dV .
S

-
W dS = divW dV .

(10)

, (10) (9),
divW dV = f ( x, y, z) dV ;

(11)

divW

f ( x, y, z)

(12)

(12) (6),
(13)
div(k( x, y, z) grad (T)) = f ( x, y, z) .
(f(x, y, z) = 0)
(k(x, y, z) = const), (13)
(14)
div( grad (T)) = 0 .
,
u = u(x, y, z)

grad (u) = u e + u e + u e ,
x
y
z
x

(15)

ex, ey, ez () , v = v(x, y, z)

div(v )

v x + v y + v z ,
x y z

(16)

vx, vy, vz - v ,
(14)

T + T + T =0
x y z
2

(17)


(18)
T = 0 ,
.
.
, W N = N(x, y, z) [1]:
(19)
W = D grad (N) ,
D = D(x, y, z) .
(,
),
.
(19) (12),
( f(x, y, z) = 0) (D(x, y, z) =
const)
(20)
div( grad ( N)) = 0 ,

N + N + N =0
x
y
z
2

(21)


(22)
N = 0 .
, ,

.

(23)
rot(E) = 0 ;

div( ( x, y, z) E)

( x, y, z)

(24)

E = E(x, y, z) ; = (x, y, z)
; = (x, y, z)

9
; 0 . (23)
.
((x, y, z) = const) ((x, y, z) = 0), (24)

div(E)

=0 .

(25)

E
[1, 4]
= grad ( ) ,

(26)

, (26) (25) (5), (15) (16),

div( grad ( ))

=0 ,

(27)


2
x
2


+
2
y
2


+
2
z
2

=0

(28)

=0 .

(29)
1.1.2.

[1, 4]

div( A( x, y, z) grad (u))

f ( x, y, z)

(30)

u = u(x, y, z) ; A(x, y, z), f(x, y, z) .


(30)

A(x, y, z) u + A(x, y, z) u + A( x, y, z) u = f ( x, y, z) , (31)


y z
x
x y
z

A( x, y, z)u

f ( x, y, z)

(32)

- ,

+ +
x y z

(33)

(30) (32) , . , .

10
V, S
X = (x, y, z), (13).
V (f(x, y, z) 0) (k = k(x, y, z)), (13)

k(x, y, z) T
x
x

k ( x, y, z)

+
y

T
y


+
z

k ( x, y, z)

T
z

= f ( x, y, z) , (34)

k ( x, y, z)T

f ( x, y, z)

(35)

(k(x, y, z) = const), k (34)


(35).

T + T + T
x y z
2

f ( x, y, z)
k ( x, y, z)

(36)

f ( x, y, z)
k ( x, y, z)

(37)

, .. k

k 11
= k 21

k 31

k
k
k

12
22
32

k
k
k

,
23

33

13

(38)

(34) [1]

k ij
x i x j
3

i , j =1

f ( x1, x 2 , x 3)

(39)

(x1, x2, x3) (x, y, z).


k
(kij = 0 i j), (39)

k T
x x
11

+
y

T
k 22


+
z

k 33 z

f ( x, y, z) .

(40)


(f(x, y, z) 0) (D = D(x, y, z))
(41)
div( D( x, y, z) grad ( N )) = f ( x, y, z) ,

11

D(x, y, z) N
x
x

+
y

D(x, y, z)

N
y


+
z

D(x, y, z)

N
z

f (x, y, z) , (42)

D( x, y, z)N

f ( x, y, z) .

(43)

(D(x, y, z) = const), (36),


(37)

N + N + N
x y
z
2

f ( x, y, z)
D( x, y, z)

(44)

f ( x, y, z)
D( x, y, z)

(45)


(23), (24). (26),

div( ( x, y, z) grad ( ))

( x, y, z)

( x, y, z)

(46)

(x, y, z)
x
x


+
y

( x, y, z)

( x , y , z )


+
z

( x, y , z )

(x, y, z)

, (47)

(48)

((x, y, z) = const), (36),


(37)

+ +
x y z
2

( x, y, z)

(49)

( x, y, z)

(50)

1.2.
, .

12
1.2.1.
, .. .
,
(35) (6)
.

V, S
X = (x, y, z).
qV, V, S, dt,
(51)
qV = QV dt ,
QV ,
V, S, (8).
, ,
qT < qV V
(52)
qT = q dT ,
q ,
V ; dT V
dt.
qS
S:
(53)
qS = QS dt ,
QS ,
S, (7).
,
(54)
q dT + QS dt = QV dt .
,
q, V

(55)
q = ( x, y, z) C ( x, y, z) dV ,
V

(x, y, z) ; (x, y, z) ,
(55), (7), (8) (54) - (10),

(x, y, z) C(x, y, z)

dV

+
dT divW dV

f (x, y, z)
=
dt

dV

, (56)
dt

13
, ,
dt (6),
:

( x, y, z) C ( x, y, z) T div(k ( x, y, z) grad (T )) = f ( x, y, z)
t

(57)

(57)

( x, y, z) C ( x, y, z) T (k ( x, y, z)T ) = f ( x, y, z) .
t

(58)

1.2.1.

,
[4].
.
2 V,
S X = (x, y, z).
, N dt
, JS, dt
S, V:

N
t

= J S + RV ,

(59)

RV V .
,
(60)
N = n( x, y, z,t )dV ,
V

n(x, y, z, t) 3,

=
S
S

j
dS
e
n

(61)

jn ; ; dS , dS ,
,
(62)
RV = R( x, y, z,t )dV ,
V

2
3

, .
, .

14
R(x, y, z, t)
, (59)

n( x, y, z,t )dV = 1 j dS + R( x, y, z,t )dV

t
e
V

(63)

(63)
- (10),

n( x, y, z,t )dV = 1 divj dV + R( x, y, z,t )dV

t
e
n( x, y, z,t ) = 1
divj + R( x, y, z,t ) .
t
e
V

(64)

(65)

(65) [2,
4]. ,
jn R(x, y, z, t).
,
,
, .

, ,

p( x, y, z,t )
t

= 1

divj + R( x, y, z,t ) ,
p

(66)

(x, y, z, t) ; jp .
(65), (66) ,
,
. .
,
(R(x, y, z, t) = 0). (65). .
,
, . , (65), .
(66)
,
, ,

15
(66)
.
, R(x, y, z, t) (65) (66) , - [5].
1.3.
, .
1.3.1.
. , , , . ,
.
x u(x, t) ,

u( x,t ) = A sin(kx + s 0) sin(wt + 0)

(67)

; k , u(x, t) ; w ()
, u(x, t) t; s0 x = 0; 0 t = 0.

k = 2

w = 2
T

(68)

.

(69)

T .
u(x, t) x

u
x

Ak cos(kx + s 0) sin(wt + 0) .

(70)

u(x, t) t

u
t

Aw sin(kx + s 0) cos(wt + 0)

u(x, t) x

(71)

16

u = A 2 sin(
k
kx + s 0) sin(wt + 0) .
x
2

(72)

u(x, t) t

u = A 2 sin(
w
kx + s 0) sin(wt + 0) .
t
2

(73)

(72) (73) (67) ,

u = 2
k u( x,t ) ;
x
u = 2
w u( x,t ) .
t
2

(74)

(75)

u(x, t) (74), (75) ,

1 u =1 u
w t k x
2

(76)

[6].
, w = 1 k = 1,

u = u
t x
2

(77)

(77) ,

u =
u
t
2

(78)

,
A = A(x, t), (76)
.
1.4.
. , ,
() - , (65), (66),
(46).
, . [2, 4].

17
1.4.1.
[2, 4]:

n( x, y, z,t ) = 1
divj + R( x, y, z,t ) ;
t
e
p( x, y, z,t ) = 1
divj + R( x, y, z,t ) ;
t
e
j = en E + eD grad (n) ;

(79)

(80)

(81)

j = ep E eD grad ( p) ;
p

(82)

div( ( x, y, z) grad ( ))

( x, y, z,t )

(83)

Dn, Dp ; n,
p .
(81), (82) , , ,
.
(26) [5]

kT ;
e
D = = kT ,
e
D =
n

(84)

(85)

T ; k ;
, (81), (82)
(86)
jn = e n n grad ( ) T grad (n) ;

= e
p

p grad ( ) + grad ( p) .

(87)

(86), (87) (79), (80), ,


n
t
p
t

[ (n grad ( ) grad (n) )] R ;


div[ (p grad ( ) + grad ( p) )] R ;

= div
=

(88)
(89)

18

div( grad ( ))

e p n + N

0

N A ,

(90)

ND, NA , .
(88) (90)

n
t
p
t

[ (n n )] R ;
[ (p + p )] R ;

=
=

(92)

e p n + N

(91)

N A ,

(93)


n
=
T
n n
x x
x

n
t

n

T
n n
y
y y

p

+ T
p p
y
y y

+ +
x y z
2

+ R ;

(94)


p
p
+

T
z p z
z

e
pn+ N

0


n
n

T
z n z
z


p
=
+ T
p p
x x
x

p
t

N A .

+ R ;

(95)

(96)

1.4.2.

(94) (96) , -, -
( , ,
, 108
1021 -3), -, - . , , ,
, . 1 [4].

19
1


ni 4


en
L
D=

=D

=
0

(94) (96) (. . 1)
, :

n
t

n n
x x x

n n
+ R ;

n n
n n

y y y z z z

p
t

+
p p
x x x

p p
+ R ;

+
+
p p
p p

y y y z z z

+ + =
n p N + N .
x y z
2

(97)

(98)

(99)

() .

20
(97) (99) . .
1.4.3.
(97) (99) = (x, y, z, t) n = n(x, y, z, t) p = p(x, y, z, t) n = n (x, y, z, t), p = p (x, y, z, t) -
R = R (x, y, z, t)
ND = ND (x, y, z) NA = NA (x, y, z).
. (97) (99) {n, p, } [2, 4].
,
. ,
, ,
, , , , .

:
- {n, p, } , ;
- {n, p, } ,
;
- {n, p, } ,
.

, [4]:
(100)
n = ln(n) ;

= ln( p) +
p

(101)

= exp( n) ;

(102)

5
= exp( p) .

(103)

(100), (101) (97) (99),


{n, p, }:

(100) (103) .

21

exp( + ) = exp( + ) n
n
n
n
x
t
x

n
n

+
n exp( n + )
+ n exp( n + )
+R ;
y
y z
z

exp( ) = exp( ) p
p
p
p
x
t
x

(104)

(105)

p
p

+
p exp( p )
+ p exp( p )
+R ;
y
y z
z

+ + =
(106)
exp( n + ) exp( p ) + N N .
x y z
2

(104) (106) :

exp( + ) = exp( + ) + R ;
n
n
n
n

(107)

exp( ) = exp( ) + R ;
p
p
p
p

(108)

= exp( n + ) exp( p ) + N N

(109)

(102), (103) (104) (106),


{n, p, }:

e = e n
t n x n
x
+

n n
+
+R ;
ne
ne

y
y z
z

(110)

22

e = e p
p

x
t p
x



p
p
+

pe
+R ;
pe

z
y
y z
+ + =

ne p e + N N .
x y z

(111)

(112)

(110) (112) :

e = e + R ;
n
t n n

(113)

e = e + R ;
p
p

t p

(114)

= n e p e + N N

(115)

2.
, ,
, . , [7].
, , ,
6, 7 [7]. , ( ).
( ),
, ( ),
.
.

.
7
.

23
2.1.
, ,
, .
(),
.
,
, . ,
, . , ,
, .
, ,
( ), ( ) [1].

(116)
u(x,t ) = g (x,t ) x , t 0 ,
u(x, t) ; g(x, t) ; x (, x = (x, y, z)), t .
,
.

..

u(x,t )
= g (x,t )
n

x , t 0 ,

(117)

n .
, , , . ,
,
..

u(x,t )
+ r (x,t ) u(x,t ) = g (x,t )
h(x,t )
n

x , t 0 ,

h(x, t), r(x, t) .

(118)

24
,
.
, , ( ) ,

W = (T T0 ) ,

(119)

; T
; T0 [8].

(6) (119) (6),

T =
(T T0 ) ;
n
T
T = T0 ,
k
n
k

(120)
(121)

(. (118)).
-, ,
,

4
4
W = (T)c T T0
0

),

(122)

0 8; 9 [8].

(6) (122) (6),

T = (T)c 4 4
T T0
n
k T
4
4
c T = c T0 .
(T) n

);

(123)
(124)

(119) (124)
T = T(x, y, z) , .
,
[6]: ,

,
.
9
.

25
,
..
2.2.
, , .. , , , (\), :
(125)
u(x,0) = (x) x \ ;

u(x,0)
= (x) x \ ;
t
u(x,0)
+ (x) u (x,0) = (x)
(x)
t

(126)

x \ ,

(127)

u(x, 0) ; (x), (x), (x)


.
, [6].
3.

,
.

[1 7].
, ( ),
. , . ,

, G. .
( )
.

26

( ).
() , LU- . [3].

, , . [1, 3].
3.1.
,
, .
3.1.1. -
, [0, s].
xi = ih, i = 0, 1, 2, , n n
h = s/n . G = {xi = ih | i = 0, 1, 2, , n} , h [1].
[0, s] n ,
0 < x1 < x2 < < xi-1 < xi < xi+1 < < xn-1 < s.
G = {xi | i = 0, 1, 2, , n, x0 = 0, xn = s}
hi = xi xi-1, i xi. hi hi+1 i, G (. 1, ).

x
x1

x2 x3

xi-1 xi xi+1 xn-1 xn

ym
yj+1
yj

z
ym 1
yj+1
yj

y2

y2

y1

x
x1

x2 x3

xi-1 xi xi+1 xn-1 xn

y1

zl
zkzk+1
z
z2k-1

z
x

x1

x2 x3

xi-1 xi xi+1 xn-1 xn

. 1. :
; ; -

27
,
G = {(xi = ih1, yj = jh2), | i = 0, 1, 2, , n, j = 0, 1, 2, , m }. G = {(xi, yj) | i = 0, 1, 2, , n, j = 0,
1, 2, , m, x0 = 0, xn = s1, y0 = 0, ym = s2} (. 1, ).
G = {(xi, yj, zk) | i = 0, 1, 2, , n, j = 0, 1, 2, , m, k = 0, 1, 2, , l, x0 = 0, xn
= s1, y0 = 0, ym = s2, z0 = 0, zl = s3} (. 1, ).
3.1.2. ,
G ,

(. . 1).
, [1, 2, 4, 6].
G = {(xi, yj, zk) | i = 0, 1, 2, ,
n, j = 0, 1, 2, , m, k = 0, 1, 2, , l, x0 = 0, xn = s1, y0 = 0, ym = s2, z0 = 0, zl = s3}.
= (xi, yj, zk), i = 0, 1, 2, , n, j = 0, 1, 2, , m, k = 0, 1, 2, , l
(xi, yj, zk) ,
G [1].
f(x, y, z), , (xi, yj, zk) ( i,j,k), G = {(xi, yj, zk) | i = 0, 1, 2, , n, j = 0, 1, 2, , m,
k = 0, 1, 2, , l, x0 = 0, xn = s1, y0 = 0, ym = s2, z0 = 0, zl = s3} (
f(x, y, z) G), .
,

i , j , k = f ( xi , y j , z k ) ;
i, j , k =

(128)

xi+1 / 2 xi1 / 2 y j+1 / 2

xi +1 / 2 y j +1 / 2 z k +1 / 2

y j1 / 2

(z

k +1 / 2

f ( x, y, z)dxdydz

z k 1 / 2 xi1 / 2 y z k 1 / 2
j 1 / 2

, (129)

xi1/2, yj1/2, zk1/2


,

xi +1 / 2 = x

i +1

+ xi

x +x ;
2
y +y
;
y j +1 / 2 =
2

xi 1/ 2 =

i 1

j +1

(130)
(131)
(132)

28

y +y
2
+z
z
=
z k +1 / 2
2
+
z k 1 / 2 = z z
2
y j 1 / 2 =

j 1

k +1

(133)

(134)

k 1

(135)

.
, ,
, ,
[1].
x
x0 , [7]:

df ( x)
dx

f ( x) f ( x0)
x x

lim

( x x0 ) 0

(136)

(136), f(x, y, z) () ,
(xi, yj, zk). [1, 2, 4], :

f ( x, y, z)

x
x
f ( x, y, z)

y
y
i +1, j ,k

i , j ,k

(137)

i , j ,k

(138)

i , j ,k

(139)

i 1, j ,k

(140)

(141)

(142)

i , j +1,k

f ( x, y, z)
z
f ( x, y, z)
x
f ( x, y, z)
y
f ( x, y, z)
z
f ( x, y, z)
x

i , j ,k +1

y
k

i , j ,k

i 1

i , j ,k

i , j 1,k

j 1

i , j ,k

z
i +1, j ,k

i , j ,k 1

k 1

2x

i 1, j ,k

i 1

(143)

29

f ( x, y, z)

y
2y
i , j +1,k

i , j 1,k

(144)

(145)

j 1

f ( x, y, z)

z
2z
i , j ,k +1

i , j ,k 1

k 1

xi, yj, zk ,
(146)
xi = xi+1 xi ;

y j = y
z k = z

j +1

(147)

(148)
(136) (138) , (139) (141) , (142) (144) [1].
, .
:
k +1

zk .

f ( x, y, z)
x

i +1, j ,k

i +1, j ,k

i 1

i , j ,k

i , j ,k

i , j ,k

(149)
i 1, j ,k

i 1

i 1

xi + xi1
2

i 1, j ,k

2
=

x + x x
i

i , j ,k

f ( x, y, z)
2

y
y + y y

i , j +1,k

i , j ,k

j 1

f ( x, y, z)
2
z
z + z
2

i , j ,k +1 i , j ,k

zk
k 1

;
y j1
i, j ,k i, j ,k 1

.
zk 1
i , j ,k

i , j 1,k

(150)

(151)

, .. xi = xi-1 = x, yj = yj-1 = y,
zk = zk-1 = z, (148) (150) :

f ( x, y , z )
x
2

i +1, j , k

i , j +1,k

i , j ,k
2

i 1, j , k

(152)

i , j 1,k

(153)

i , j ,k 1

(154)

i , j ,k
2

f ( x, y, z)
y
f ( x, y, z)
z

i , j ,k +1

i , j ,k
2

30

:

f ( x, y, z)
xy

i +1, j +1,k

i , j +1,k +1

f ( x, y, z)
xz

i , j ,k +1

i +1, j ,k +1

i , j ,k +1

i , j ,k

i +1, j +1,k

i , j +1,k
i

i , j +1, k

i +1, j ,k

i , j ,k

(155)

i , j +1,k +1

i , j ,k +1

y z
j

i +1, j ,k

i , j ,k

x y

i +1, j ,k

i , j +1,k

f ( x, y, z)
yz

i , j ,k

i +1, j ,k +1

i , j ,k +1

x z
i

i , j +1,k

i , j ,k

(156)

i +1, j ,k

i , j ,k

(157)

[1].
(137) (157)
[6].
,
, .
(i, j, k), (i1, j1, k1),
(i2, j2, k2) ..
, , .
,

f ( x)

x
x
i +1

(158)

f ( x)

x
x
i

(159)

i 1

i 1

.
(152)

31

.
(155)

.
3.2.
,
,
() .
3.2.1.
.
{pi | i = 1, 2, , n} .
i- i , pi, pj (. 2).
{i | i = 1, 2, , n}
[2]. (. 3).

. 2.

. 3.

32
, , [2],
.

, , ,
. ,
(. 4), [2]:
1) () ;
2) ,
;
3) ,
, 3 , .

. 4. ( )
( )
,

(. . 4). , [2]. , .
-
, . ,
, (. 5).
.

33

. 5. ,

. 6.
, (. 6),
[2].
[2]. , . , i- i-
i . , i-1 .
, [2], , (. 7), , 1, , . , , , , , , -

34
. 1
.

. 7.
1 (. 8).

. 8.

(. 9).

35

. 9.
,
, . 10.

. 10.
(. 11).

36

. 11.
[2]:
-
, ;
- , ,
( );
- , ,
,
.
, ,
. ,
, , . [2].

, D, , D D (. 12) [9].

. 12. ,

37
. , ,
[9].
[9].
1. .
2.
, , .
3.2.2.


[2]. .
,
. V, S, ,
(46) (48).
(46) V,

1
div( ( x, y, z) grad ( ))dV + ( x, y, z)dV = 0 ,

(160)

1
( ( x, y, z) )dV + ( x, y, z)dV = 0 .

(161)

1
( x, y, z)dS + ( x, y, z)dV = 0 .

(162)

0 V

0 V

- (10),
(161)
S

0 V

(162)
(48)
.
(162) 0 D, p0 (. 13)
, (
H,
), :

38

H
H ( x, y, z)dl + ( x, y, z)dS = 0 ,
S
D

(163)

dl D; dS0 , p0 (. . 13);

. 13. m-

M0
m=1

Pm

+ P0

+ 1
S =0 ,

h
m

(164)

M0 D; S0 , p0 (. . 13); 0, m p0 pm, ; P0, Pm p0 pm, ; 0


p0; hm
p0 pm; m m- .
(164) ,

Mi
m =1

Pm

+ Pi

+ 1
S = 0 , i =1,2,..., N

h
m

int

(165)

i ; Nint .
(. . 13)
,

39
. ,

( x, y, z)
= g ( x, y, z )
n

( x, y, z) ,

(166)

n ; g(x, y, z) ,

M

m=1

Pm g +
m

Mi

m= M +1

Pm

+ Pi

+ 1
S = 0 , i =1,2,..., N

h
m

ext

, (167)

, ; Next
, .. , (. . 13); gm g(x, y, z) m-
.
, (165), (167), (48), (166)
,
.
N = Nint + Next.
4.
( ), ( ) ( ) .
4.1.
()
, LU- ., [3]. ,
,
.
, . .
.
n n

40

a x + a x + a x +K+ a
a x + a x + a x +K+ a
a x + a x + a x +K+ a
M
a x + a x + a x +K+ a
13

1n

x =b ;
x =b ;
x =b ;

11

12

21

22

23

2n

31

32

33

3n

n1

n2

n3

nn

(168)

x =b ,
n


A x =B ,

(169)

x = [x1, x2, x3, , xn] - ; A = [aij], i = 1, 2, , n, j =


1, 2, , n n n; B = [b1, b2, b3, , bn]
- .
(169) -
B -1, [7]
1
(170)
x =A B .
4.1.1.
, aij = 0
i > j:

a x + a x + a x +K+ a
a x + a x +K+ a
a x +K+ a
M
a
11

12

22

13

1n

23

2n

33

3n

x =b ;
x =b ;
x =b ;

nn

x =b .

(171)

, aij = 0 i < j, :

a x =b ;
a x +a =b ;
a x +a x +a x =b ;
M
a x + a x + a x +K+ a x = b .
11

21

22

31

32

33

n1

n2

n3

nn

(172)

, (171)
, (172) [3].

41
, = ( )

(173)
aii 0 , i =1,2,..., n ,
[3].

. , (171) n- xn,
:

b
a

(174)

nn

(174), (n - 1)-

xn1 =

n 1

a( n 1) n xn

(175)

( n 1)( n 1)

, , :

bi

a x

j =i +1

ij

i = n 1, n 2,...,2,1 .

(176)

ii

( 1- ) .
(168) [3].
(168) (171) (172),
.
,
[3].
, :
1) ;
2) ;
3)
, .
, , , .
[3].

(177)
y = A + Bx + Cx2 ,

42
(1, 1), (2, -1), (3, 1).
(177),
, x y.
,
(177):

A + B + C = 1;
A + 2B + 4C = 1;
A + 3B + 9C = 1.

(178)


, .
:

A+

B+ C =
1;
B + 3C = 2;
2B + 8C =
0.

(179)

(179)
, 2.
:

A+ B + C =
1;
B + 3C = 2;
2C =
4.

(180)

(180),
: = 2, = -8, = 7. ,
(181)
y = 7 8 x + 2 x2 .
4.1.2. LU-

(168), (169). ,
n n 10.
(182)
A = LU ,
L n n,
; U n n.
(169)

10

n n , [3].

43

LUx = B

(183)

- Y,
Ux = Y .

(184)

(184) (183),
LY = B .

(185)

(183) (185) (184), [3].


,
.. , . [3].

3 1
4

A = 2 4 5 .
1 2 6

(186)

A = EA

(187)

, ,
.
(187),

3 1
1 0 0 4

A = 0 1 0 2 4 5 .
0 0 1 1 2 6

(188)

3 1
1 0 0 4

A = 0.5 1 0 0 2.5 4.5 ;


0 0 1 1
2
6

(189)


, :
, -0.5, l21

, 0.25, l31

44

1
3
1 0 0 4

A = 0.5 1 0 0 2.5 4.5 ;


0.25 0 1 0 1.25 6.25

(190)

0 0 4
3 1
1

1 0 0 2.5 4.5 .
A = 0.5


0.25 0.5 1 0
0 8.5

(191)

, -0.5, l32

0 0
1

1 0 ;
L = 0.5

0.25 0.5 1
3 1
4

U = 0 2.5 4.5 .
0
0 8.5

(192)

(193)

, LU .
,
LU- [3]. , , ( ), LU , .
, , .
.
4.1.3.

, ,
. ,
-

45
, [1, 3].
LU (n3) [3],
, , - .
(168).
:

= b1

a12 x2 + a13 x3 + K + a1n xn

a
b a x +a x
x=
a

11

21

23

+ K + a 2 n xn

22

M
x

bi ai1 x1 + K + ai (i1) xi1 + ai (i+1) xi+1K + ain xn


a

(194)
;

ii

M
xn =

b a x +a x
a
n

n1

n2

+ K + an ( n1) xn 1

nn

(194) , :
1) . , , . ;
2) x(0) = [x1(0), x2(0), , xn(0)]11. ,
. , ,
n- , ,
;
3) x(k) = [x1(k), x2(k), , xn(k)]
x(k-1) = [x1(k-1), x2(k-1), , xn(k-1)]
(194)

(k )

b a x
=
i

i1

( k 1)

i = 1, 2, , n;

11

( k 1)

( k 1)

( k 1)

+ K + ai ( i 1) xi 1 + ai ( i +1) xi +1 K + ain xn

ii

(195)

46
4) k- . ,

max( x1(k ) x1(k 1) , x (2k ) x (2k 1) ,..., x (nk ) x (nk 1) )


max( x1(k 1) ,

x (2k 1) ,...,

x (nk 1) )

5)
,

(196)

(197)


.
. 3) .
. , .
.
, , , . , . , .
.
, , (196) , . ,
.
(196)
, ,

max( x1(k ) x1(k 1) , x (2k ) x (2k 1) ,..., x (nk ) x (nk 1) )


max( x1(0) ,

x (20) ,...,

x (n0) )

(198)

.
.
(195),
xi(k) , i-, xj(k-1) . , xi(k)
j < i , xi(k).
, [3]:
1) ;

47
2) x(0) = [x1(0), x2(0), , xn(0)];
3) x(k) = [x1(k), x2(k), , xn(k)]

(k )

b a x
=
i

i1

(k )

(k )

( k 1)

( k 1)

+ K + ai ( i 1) xi 1 + ai ( i +1) xi +1 K + ain xn

(199)

ii

i = 1, 2, , n;
4) k- ;
5)
,

(200)


.
. 3) .
, - , (199), .
.

2;
2 x1 x 2 + x3 =
4 x1 6 x 2 + x3 = 4;
2 x1 + x 2 + 8x3 = 16

(201)

2 + x 2 x3 ;
2
4 4 x1 x3 ;
x2 =
6
16 + 2 x1 x 2 ,
=
x3
8

(202)

(0) = [1, 2, 2].


(201)

x1 =

(202) MATLAB.

MATLAB :
function X=yakobi(A,B,X0,delta,Imax)
% .
% A
-
%
n x n;

48
%
%
%
%
%

B
X0
delta
Imax
X

- ;
- ;
;
;
AX = B.

n=length(B);
err=5*delta;
X=X0;
ct=0;
while err>delta
Xp=X;
for i=1:n
X(i)=(B(i)-A(i,[1:i-1,i+1:n])*
Xp([1:i-1,i+1:n]))/A(i,i);
end
if max(abs(X0))==0
error(' ')
break
end
err=max(abs(X-Xp))/max(abs(X0));
ct=ct+1;
Xe(ct,:)=[X' err];
if ct>Imax
error(' ')
break
end
end
Xe
ct

MATLAB [10, 11].
10-5
100, MATLAB,
yakobi.m /WORK ,
MATLAB, , .
A=[ 2 -1 1; 4 -6 1; -2 1 8];
B=[2; -4; 16];
X0=[1; 2; 2];
X=yakobi(A,B,X0,1e-5,1e2)

49
3 3,
- 3 1, - 0 3 1 .

Xe =
1.0000
0.8333
0.8125
0.7813
0.7669
0.7598
0.7551
0.7529
0.7516
0.7509
0.7505
0.7503
0.7501
0.7501
0.7500
0.7500
0.7500

1.6667
1.6667
1.5625
1.5417
1.5221
1.5117
1.5068
1.5036
1.5020
1.5011
1.5006
1.5003
1.5002
1.5001
1.5001
1.5000
1.5000

2.0000
2.0417
2.0000
2.0078
2.0026
2.0015
2.0010
2.0004
2.0003
2.0001
2.0001
2.0000
2.0000
2.0000
2.0000
2.0000
2.0000

0.1667
0.0833
0.0521
0.0156
0.0098
0.0052
0.0025
0.0016
0.0008
0.0005
0.0002
0.0001
0.0001
0.0000
0.0000
0.0000
0.0000

ct =
17

X =
0.7500
1.5000
2.0000,
1, 2, 3 , ,
ct , .
, (201)
-5
10 (0) = [1, 2, 2]
17 .

50
MATLAB :
function X=zeydel(A,B,X0,delta,Imax)
%
%
%
%
%
%
%
%

-.
A
-
n x n;
B
- - ;
X0
- - ;
delta - ;
Imax - ;
X
- AX = B.

n=length(B);
err=5*delta;
X=X0;
ct=0;
while err>delta
Xp=X;
for i=1:n
X(i)=(B(i)-A(i,[1:i-1,i+1:n])*
X([1:i-1,i+1:n]))/A(i,i);
end
if max(abs(X0))==0
error(' ')
break
end
err=max(abs(X-Xp))/max(abs(X0));
ct=ct+1;
Xe(ct,:)=[X' err];
if ct>Imax
error(' ')
break
end
end
Xe
ct
- 10-5
100 .
zeydel.m /WORK ,
MATLAB,
, .

51
A=[ 2 -1 1; 4 -6 1; -2 1 8];
B=[2; -4; 16];
X0=[1; 2; 2];
X=zeydel(A,B,X0,1e-5,1e2)
3 3,
- 3 1, - 0 3 1 - .

Xe =
1.0000
0.8125
0.7695
0.7558
0.7517
0.7505
0.7502
0.7500
0.7500
0.7500

1.6667
1.5486
1.5146
1.5044
1.5013
1.5004
1.5001
1.5000
1.5000
1.5000

2.0417
2.0095
2.0031
2.0009
2.0003
2.0001
2.0000
2.0000
2.0000
2.0000

0.1667
0.0937
0.0215
0.0069
0.0020
0.0006
0.0002
0.0001
0.0000
0.0000

ct =
10

X =
0.7500
1.5000
2.0000.
, (201)
10 (0) = [1, 2, 2] 10 . - 1.7 ,
.
-5

52
,
- ,
.
= [aij] n n ,

ii

> aij ,

(203)

j =1
j i


[3].
-
.
, = =
- {(k)}, (0) [3].
. , - .
(201)
.

4 6 1

A = 2 1 1 ,
2
1 8

(204)

,
(203) .
, 15 12
Xe =
1.0e+003 *
0.0015
0.0015
0.0030
0.0032
0.0073
0.0086
0.0203
12

0.0020
0.0030
0.0031
0.0059
0.0067
0.0147
0.0181

0.0020
0.0021
0.0020
0.0024
0.0021
0.0030
0.0023

0.0003
0.0005
0.0007
0.0014
0.0021
0.0040
0.0059

, 1.0+003 (103)
.

53
0.0256
0.0591
0.0793
0.1758
0.2472
0.5275
0.7704
1.5901
2.3959

0.0409
0.0541
0.1196
0.1666
0.3565
0.5175
1.0723
1.6080
3.2388

0.0048
0.0033
0.0100
0.0069
0.0251
0.0192
0.0692
0.0606
0.1985

0.0114
0.0167
0.0327
0.0483
0.0950
0.1402
0.2774
0.4098
0.8154

??? Error using ==> yakobi



-
:
Xe =
1.0e+007 *
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0001
0.0002
0.0005
0.0015
0.0044
0.0133
0.0399
0.1196
0.3587
1.0762

0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0001
0.0003
0.0010
0.0030
0.0089
0.0266
0.0797
0.2391
0.7174
2.1523

0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000

0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0001
0.0003
0.0010
0.0030
0.0089
0.0266
0.0797
0.2391
0.7174

??? Error using ==> zeydel



. ,
-
(203).

54
- , , - [3].
, , ,
. ,
, [1, 3].


LU-,

.
,

a x + a x + a x +K+ a
a x + a x + a x +K+ a
a x + a x + a x +K+ a
M
a x + a x + a x +K+ a
13

1n

x =b ;
x =b ;
x =b ;

11

12

21

22

23

2n

31

32

33

3n

n1

n2

n3

nn

(205)

x =b .
n

(205) 2 :

a x + a x + a x +K+ a x = b ;
a x + a x + a x +K+ a x = b ;
a x + a x + a x +K+ a x = b ;
M
a x + a x + a x +K+ a x = b
12

21

22

23

2n

31

32

33

3n

( n / 2) 2

( n / 2 )1

13

1n

11

( n / 2)3

( n / 2) n

(206)

n/2

a
a
a

x +a
x +a
x +a
M
a x + a x + a x +K+ a
( n / 2+1)1

( n / 2 + 2 )1

( n / 2 + 3)1

n1

x +a
x +a
x +a

( n / 2+ 2 ) 2

( n / 2+ 2 ) 3

( n / 2+ 2 ) n

n / 2+ 2

( n / 2 + 3) 2

( n / 2 + 3) 3

( n / 2 + 3) n

n / 2+3

nn

n3

x =b .
n

n / 2 +1

n2

( n / 2 +1) n

x =b
x =b
x =b

( n / 2+1) 2

( n / 2 +1) 3

x +K+ a
x +K+ a
x +K+ a

(207)

55
:
1) ;
2) {x1, x2, x3, , xn/2} (
);
3) {x1, x2, x3, , xn/2} (207);
4) (207) {xn/2+1, xn/2+2, xn/2+3, ,
xn} ( , LU-,
.);
5) {xn/2+1, xn/2+2, xn/2+3, , xn}
(206);
6) (206) {x1, x2, x3, , xn/2} ( , LU-, .);
7)
, ,

max( x1(i) x1(i 1) , x (2i) x (2i 1) ,..., x (ni)/ 2 x (ni /21) )


max( x1(0) ,

x (20) ,...,

x (n0/)2 )

(208)


;
8)
(209)
,


{x1, x2, x3, , xn}. . 3) .
2
, (206) (207) 2 , (205), . (205) , .
4.2.
, ,
, -
[1, 3].

56
4.2.1.

x
x
x

f (x , x ,K , x );
f (x , x ,K , x );
f (x , x ,K , x );
M
f (x , x ,K , x ),
1

(210)

f1, f2, , fn (x1, x2, x3, , xn).


(210)
= (1, 2, , n), [3]

f p , p ,K , p

p1 , p 2 ,K , p n ;
2

p1 , p 2 ,K , p n ;
3

(211)

M
p

f p , p ,K , p
n

, (210).
, , :
1) ;
2) x(0) = [x1(0), x2(0), , xn(0)];
3) x(k) = [x1(k), x2(k), , xn(k)]
x(k-1) = [x1(k-1), x2(k-1), , xn(k-1)]
(210)
(k ) =

xi

f i ( x1(k 1) , x (2k 1) , x3(k 1) ,K , x (nk 1)) ,

(212)

i = 1, 2, , n;
4) k-

max( x1(k ) x1(k 1) , x (2k ) x (2k 1) ,..., x (nk ) x (nk 1) )


max( x1(0) ,

x (20) ,...,

x (n0) )

(213)

57
5)
,

(214)


.
. 3) .
-
,
(212),
(k ) =

xi

f i ( x1(k ) , x (2k ) ,K , xi(k 1) , xi(k 1) ,K , x (nk 1)) ,

(215)

i = 1, 2, , n.

.
(210) f1, f2, , fn
,
= (1, 2, , n).
x(0) = (x1(0), x2(0), , xn(0))

f 1
x1

p1, p 2,K, p n

f 2
x1

p1, p 2,K, p n

f 3
x1

p1, p 2,K, p n

f 1
x 2

+K +

p1, p 2,K, p n

f 2
x 2

+K +

p1, p 2,K, p n

f 3
x 2

+K +

p1, p 2,K, p n

f 1
x n

<1 ;

p1, p 2,K, p n

f 2
x n

<1 ;

p1, p 2,K, p n

f 3
x n

<1 ;

p1, p 2,K, p n

M
f n
x1

p1, p 2,K, p n

f n
x 2

+K +

p1, p 2,K, p n

f n
x n

<1 ,

p1, p 2,K, p n

, (212) (215), .

(216)

58
(216) . (216) ,
( ) . ,

1 [3].


(217)
x = g (x) ,
g(x) .
, (217)
:
=
y

y =

g ( x) ;
x

(218)

(218) , ,
(217), y = g(x) y = x
(. 14).
= 0 (. . 14).
y = g(x), y, y = x, = 1
(. . 14).

. 14.

59
, ,
= 2, , ,
(. . 14).
,

dg ( x)
<1 ,
dx

(219)

. , . k- (k 1)- ,
, (213).
, k- , , . , , , ,
(213), k- (k 1)- . , k-
( ) , (213).
(. . 14)
,
. [3].
. 15 (217), (219).
, .
[3].
(217), (218) ,
(219) ,

dg ( x)
>1 ,
dx

(220)

, = 0 ,
.
dg(x)/dx
( dg(x)/dx > 1, . 16) ( dg(x)/dx < -1, . 17) [3].

60

. 15.

. 16.

61

. 17.
4.2.2. -
(217).

(221)
f ( x) = 0 .
f(x), , (221) - ( ),
, [1 4].
(221) , y = f(x) (. 18).
= 0 . = 1
y = f(x) = 0. = 1 , = 0 (. . 18).
, 0 1,
y = f(x),
= 0 = 1:

df ( x)
dx x = p

=
0

( ) ( ).

f p1 f p 0
p1 p 0

(222)

62

. 18. -
, f(p1) = 0 (. . 18),

p1 = p 0

f ( p 0)
df ( x)
dx x = p

(223)

(223) k- ,

p k = p k 1

f ( p k 1)
df ( x)
dx x = p

(224)

k 1


n,

f (x , x ,K , x ) = 0 ;
f (x , x ,K , x ) = 0 ;
f (x , x ,K , x ) = 0 ;
M
f (x , x ,K , x ) = 0 .
1

(225)

63
(225)
F ( x) = 0 ,

(226)

x = [x1, x2, , xn] - ; 0 n, 0.


- n :
1) ;
2) x(0) = [x1(0), x2(0), , xn(0)];
3) x(k) = [x1(k), x2(k), , xn(k)]
x(k-1) = [x1(k-1), x2(k-1), , xn(k-1)]
, (224):

d F (x )

(k )
( k 1)
x =x

dx
(
k
1
)

dF(x )

dx
(
k
1
)

d F (x )

dx

F (x ( k 1)) ,

(227)

f 1

x1
f 2
=
x1

f n

x1

n n,

f 1
x 2
f 2
x 2
f n
x 2

K
K
M
K

f 1

x n
f 2

x n

f n

x n

(228)

[3], x(k-1) = [x1(k-1), x2(k-1), , xn(k-1)];


4) k-

max( x1(k ) x1(k 1) , x (2k ) x (2k 1) ,..., x (nk ) x (nk 1) )


max( x1(0) ,

5)
,

x (20) ,...,

x (n0) )

(229)

(230)

64

.
. 3) .
, , - ,
. 19 [3].
, ,

(. 20) [3].
- [3].
(226).

d
(
)
F
x

G ( x) = x
dx

F (x

-.

. 19.
-

(231)

65

. 20.
-
= (1, 2, , n) (226).

F (P )

=0 .

(232)

(232) (231),

G (P )

=P .

(233)

, -
(231), , -

66

g 1
x1

p1, p 2,K, p n

g 2
x1

p1, p 2,K, p n

g 3
x1

p1, p 2,K, p n

g 1
x 2

+K +

p1, p 2,K, p n

g 2
x 2

+K +

p1, p 2,K, p n

g 3
x 2

+K +

p1, p 2,K, p n

g 1
x n

<1 ;

p1, p 2,K, p n

g 2
x n

<1 ;

p1, p 2,K, p n

g 3
x n

<1 ;

p1, p 2,K, p n

M
g n
x1

p1, p 2,K, p n

g n
x 2

+K +

p1, p 2,K, p n

g n
x n

<1 .

p1, p 2,K, p n

(234)

[1, 3, 7] ,
,
- . ,
, . -, .
5.
MATLAB
MATLAB 5..
5.1.
, . ,
, .

67
5.1.1.

u
x
2

f ( x) ,

(235)

; u(x) ; f(x)
, [xmin, xmax]
x = xmin, x = xmax.
[xmin, xmax]
:

x = {xi |i =1,2,...,n } .

(236)

()

u ( x1) = g1 ;

(237)

u ( xn) = g 2 ,

(238)

1, xn [xmin, xmax]; g1, g2


.
()

du
dx
du
dx

=g ;
1

(239)

=g .
2

(240)

x1

xn

(236) ,
(241)
u1 = g ;
1

un = g 2 ,

(242)

u1, un u(x) x1, xn, .


(236),

u 2u1 = ;
g1
x

(243)

68

u nu n 1 = .
g2
x

(244)

(235) ,

ui +12ui +ui 1
2
x

f i , i = 2,K, n 1 ,

(245)

fi f(x) xi.
,
n, n 2
(245) (241) (243) (242)
(244) .
(235) (237) (240) (236).
%
% d2u/dx2=f(x,y)
% /
function[x,u]=puass_1d(x0,xn,n,f,v1,g1,v2,g2)
% :
% x0 - ;
% xn - ;
% n - ;
% f - ,
%
,
%
, , 'exp(-x)+exp(-y)';
% v1 - ,
%

%
= (1) (1 - , 2 - );
% g1 -
%
, , '0';
% v2 - ,
%

%
= (n) (1 - , 2 - );
% g2 -
%
.
% :
% - -
%
1 n;
% U - U
%
1 n.

69
%
if exist('x0')==0
x0=0;
end
if exist('xn')==0
xn=5;
end
if exist('n')==0
n=50;
end
if exist('f')==0
f='2*sin(x^2)+10*cos(x^2)';
end
if exist('v1')==0
v1=1;
end
if exist('g1')==0
g1='0';
end
if exist('v2')==0
v2=2;
end
if exist('g2')==0
g2='-0.5';
end
%
x=x0:(xn-x0)/(n-1):xn;

dx=x(2)-x(1);

% , ,
%
F=inline(f,'x');
G1=inline(g1,'x');
G2=inline(g2,'x');
% n x n,
% 0
a=zeros(n,n);

70
% -
% 1 x n,
% 0
b=zeros(1,n);
% ,
%
% v1, v2
b(1)=G1(x(1));
if v1==1
a(1,1)=1;
elseif v1==2
a(1,1)=-1/dx;
a(1,2)=1/dx;
else
error('Parameter v1 have incorrect value');
end
b(n)=G2(x(n));
if v2==1
a(n,n)=1;
elseif v2==2
a(n,n)=1/dx;
a(n,n-1)=-1/dx;
else
error('Parameter v2 have incorrect value');
end
% ,
%
for i=2:n-1
a(i,i)=-2/dx^2;
a(i,i+1)=1/dx^2;
a(i,i-1)=1/dx^2;
b(i)=F(x(i));
end
%
u=b/a';

71
% u(x,y)
plot(x,u)
xlabel('x')
ylabel('u')
grid on
, %, .
puass_1d.m /WORK, MATLAB.
puass_1d :
puass_1d;
x=puass_1d;
[x,u]=puass_1d;
[x,u]=puass_1d(x0,xn,n,f,v1,g1,v2,g2).
, ,
.
;
,
.
; .
; , , u.
,
puass_1d;
f()
(235),

f ( x) = 2 sin(x2) +10 cos(x2) ,

(246)

u ( xmin) = 0
du
dx

= 0.5

(247)
(248)

xmax

xmin = 0, xmax = 5 ,
50 (. 21).

72

. 21.
puass_1d

[x,u]=puass_1d(-1,6,100,'sin(x)',1,'1',2,'-0.5');
f()
(235),
(249)
f ( x) = sin(x) ,

u ( xmin) =1
du
dx

= 0.5

(250)
(251)

xmax

xmin = -1, xmax = 6 ,


100 (. 22).

73

. 22.
puass_1d ,
puass_1d (
), . .
5.1.2.

u + u
x y
2

f ( x, y) ,

(252)

, y ; u(x, y) ; f(x, y) ,
x = xmin, x = xmax, y = ymin, y = ymax.
[xmin, xmax]
:

x = {xi |i =1,2,...,n } ,

(253)

[ymin, ymax] y:

y = {y j| j =1,2,...,m } .

(254)

, (253) (254), :

74
G = {(xi = i, yj = jy), | i = 1, 2, , n, j = 1, 2, , m }.

(255)

()

u (x1 , y ) = g1( y) ;

(256)

u ( xn , y ) = g 2 ( y) ;

(257)

u (x , y1) = g 3( x) ;

(258)

u ( x , y m) = g 4 ( x) ,

(259)

1, xn xmin, xmax; y1, ym


ymin, ymax; g1(y), g2(y), g3(x), g4(x) .
()

u
x

=g

=g

=g

2 ( y)

(261)

3( x)

(262)

(263)

x , y1

u
y

(260)

x n, y

u
y

x1, y

u
x

1( y)

=g

4 ( x)

x , ym

(255) ,

u1, j = g1( y j) ;

(264)

u n, j = g 2 ( y j) ;

(265)

ui,1 = g 3( xi ) ;

(266)

75

u i, m = g 4 ( xi ) ,

(267)

u1,j, un,j, ui,1, ui,m u(x, y) (x1, yj), (xn, yj), (xi, y1), (xi,
ym), .
(255),

u 2, j u1, j
= g (y ) ;
1 j
x

(268)

u n, j u n1, j
= g (y ) ;
j
2
x

(269)

ui,2 ui,1
= g (x ) ;
3 i
y

(270)

ui,m ui,m1
= g (x ) .
4 i
y

(271)

(252) ,

ui +1, j 2ui, j +ui 1, j ui, j +1 2ui, j +ui, j 1


+
2
y 2
x

f i, j ,

i = 2,K, n 1 ; j = 2,K, m 1 ,

(272)

fi,j f(x, y) (xi, yj).


,
nm, (n 2)(m 2) (272) 2n + 2(m 2)
(264) (268), (265) (269), (266) (270) (267) (271)
.
(252) (256) (263) (255).
%
%
%
%


d2u/dx2+d2u/dy2=f(x,y)

/

function[x,y,U]=
puass_2d(x0,xn,n,y0,ym,m,f,v1,g1,v2,g2,v3,g3,v4,g4)
% :

76
-

;
;
y;
y;
;
y;
,
,
, , 'exp(-x)+exp(-y)';
,

= (1) (1 - , 2 - );

,
,
;
,

= (n) (1 - , 2 - );

,
,
;
,

y = y(1) (1 - , 2 - );

,
,
;
,

y = y(m) (1 - , 2 - );

,
,
.

%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%

x0
xn
y0
ym
n
m
f

%
%
%
%
%
%
%

:
- -
1 n;
y - - y
1 m;
U - U
n m.

v1 -

g1 -

v2 -

g2 -

v3 -

g3 -

v4 -

g4 -

77
%
if exist('x0')==0
x0=0;
end
if exist('xn')==0
xn=1;
end
if exist('n')==0
n=10;
end
if exist('y0')==0
y0=0;
end
if exist('ym')==0
ym=2;
end
if exist('m')==0
m=20;
end
if exist('f')==0
f='exp(-x)+exp(-y)';
end
if exist('v1')==0
v1=1;
end
if exist('g1')==0
g1='sin(y^2)';
end
if exist('v2')==0
v2=1;
end
if exist('g2')==0
g2='cos(3*y)';
end
if exist('v3')==0
v3=2;
end
if exist('g3')==0
g3='10*sin(x^2)';
end
if exist('v4')==0
v4=2;
end

78
if exist('g4')==0
g4='10*sin(6*x)';
end
%
x=x0:(xn-x0)/(n-1):xn;
y=y0:(ym-y0)/(m-1):ym;

dx=x(2)-x(1);
dy=y(2)-y(1);

% , ,
%
F=inline(f,'x','y');
G1=inline(g1,'y');
G2=inline(g2,'y');
G3=inline(g3,'x');
G4=inline(g4,'x');
%
N=n*m;
% N x N,
% 0
a=zeros(N,N);
% -
% 1 x N, 0
b=zeros(1,N);
% ,
%
% v1, v2, v3, v4
for j=1:m
b(j)=G1(y(j));
if v1==1
a(j,j)=1;
elseif v1==2
a(j,j)=-1/dx;
a(j,m+j)=1/dx;
else
error('Parameter v1 have incorrect value');

79
end
b(m*(n-1)+j)=G2(y(j));
if v2==1
a(m*(n-1)+j,m*(n-1)+j)=1;
elseif v2==2
a(m*(n-1)+j,m*(n-1)+j)=1/dx;
a(m*(n-1)+j,m*(n-2)+j)=-1/dx;
else
error('Parameter v2 have incorrect value');
end
end
for i=2:n-1
b(m*(i-1)+1)=G3(x(i));
if v3==1
a(m*(i-1)+1,m*(i-1)+1)=1;
elseif v3==2
a(m*(i-1)+1,m*(i-1)+1)=-1/dy;
a(m*(i-1)+1,m*(i-1)+2)=1/dy;
else
error('Parameter v3 have incorrect value');
end
b(m*(i-1)+m)=G4(x(i));
if v4==1
a(m*(i-1)+m,m*(i-1)+m)=1;
elseif v4==2
a(m*(i-1)+m,m*(i-1)+m)=1/dy;
a(m*(i-1)+m,m*(i-1)+m-1)=-1/dy;
else
error('Parameter v4 have incorrect value');
end
end
% ,
%
for i=2:n-1
for j=2:m-1
a(m*(i-1)+j,m*(i-1)+j)=-2/dx^2-2/dy^2;
a(m*(i-1)+j,m*(i)+j)=1/dx^2;
a(m*(i-1)+j,m*(i-2)+j)=1/dx^2;
a(m*(i-1)+j,m*(i-1)+j+1)=1/dy^2;
a(m*(i-1)+j,m*(i-1)+j-1)=1/dy^2;
b(m*(i-1)+j)=F(x(i),y(j));
end
end

80
%
u=b/a';
%
%
%
%

-
n x m,

for i=1:n
for j=1:m
U(i,j)=u(m*(i-1)+j);
end
end
% U(x,y)
surf(y,x,U)
xlabel('y')
ylabel('x')
zlabel('U')
grid on

puass_2d.m /WORK,
MATLAB.
puass_2d :
puass_2d;
x=puass_2d;
[x,y]=puass_2d;
[x,y,U]=puass_2d;
[x,y,U]=puass_2d(x0,xn,n,y0,ym,m,f,v1,g1,v2,g2,v3,g3,v4,g4).

, , , .
;
,
.
; .
; ,
,
y.

81
; , , , y U.
,
puass_2d;
f(, y)
(252),

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

(273)


2
u (xmin, y ) = sin( y )

u (xmax, y ) = cos(3 y )
du
dy

= 10 sin(x

(275)

(276)

x , y1

du
dy

(274)

= 10 sin(6x)

(277)

x , ym

xmin = 0, xmax = 1, ymin = 0, ymax = 2


, 200 (10 20) (. 23).

[x,y,U]=puass_2d(-1,2,20,0.35,5,30,'x^2+3*y',1,
'2*y*sin(3*y)',1,'3*y*cos(4*y)',2,'2-x',2,'3*x^2');
f(, y)
(252),

f ( x, y) = x2 + 3 y

(278)

u (xmin, y ) = 2 ysin(3y )

(279)

82

. 23.
puass_2d

u (xmax, y ) = 3 ycos(4 y )
du
dy

= 2 x

(280)

(281)

x , y1

du
dy

= 3x 2

(282)

x , ym

xmin = -1, xmax = 2, ymin = 0.35, ymax = 5


, 600 (20 30) (. 24).

83

. 24.
puass_2d ,
puass_2d
. .
5.1.3.

(252) , (273) (274) (277) xmin =
0, xmax = 1, ymin = -1, ymax = 1 .
MATLAB 5.
pdetool.

pdetool.

(. 25).

84

. 25. pdetool
,
, (0, 1) , (1, -1) , ,
. (. 26).
,
.
(. 27). y, . . .
.

, .
.
Set formula , + - (. . 26).

85

. 26. pdetool

. 27.
pdetool
,
, . 28.

86

. 28. pdetool
, ( ). (. 29 32).

. 29.

87
y , ,
, x y.

,
PDE, , . 33.

. 30.

. 31.

. 32.

88

. 33. pdetool

(. 34).
(. 35).

. 34.
pdetool

89

. 35. pdetool
=.
(. 36).
(3D) ,
,
, . 37.
Plot ,
. 38.

90

. 36. pdetool

. 37.
pdetool

91

. 38. 3D-
pdetool
HELP MATLAB [10, 11].
5.2.

( x, y) C ( x, y) T (k ( x, y)T ) = f ( x, y)
t

(283)

t ; , y ; T(x, y) ; (x, y) ;
(x, y) ; k(x, y) ; f(x, y) ,
x = xmin, x = xmax, y = ymin, y = ymax
[tmin, tmax].
[xmin, xmax]
:

x = {xi |i =1,2,...,n } ,
[ymin, ymax] y:

(284)

92

y = {y j| j =1,2,...,m } ,

(285)

[tmin, tmax] t:

t = {t l |l =1,2,...,s } .

(286)

, (284) (286), - :
G = {(xi = i, yj = jy, tl = lt), | i = 1, 2, , n, j = 1, 2, , m, l = 1, 2, , s }. (287)
()

T ( x1 , y ,t ) = g1( y) ;

(288)

T ( xn, y ,t ) = g 2 ( y) ;

(289)

T ( x , y1 ,t ) = g 3( x) ;

(290)

T ( x , y m,t ) = g 4 ( x) ,

(291)

1, xn xmin, xmax; y1, ym


ymin, ymax; g1(y), g2(y), g3(x), g4(x) .
()

T
x

=g

2 ( y)

(293)

3( x)

(294)

(295)

xn, y ,t
=g
x , y1,t

T
y

(292)

=g

T
y

x1, y ,t

T
x

1( y)

=g
x , ym,t

4 ( x)

93

T ( x , y ,t1) = g t ( x, y) ,

(296)

t1 ; gt(x, y)
.

T
t

=g

t ( x, y)

(297)

x , y ,t1

(287) ,

T 1, j , l = g 1 ( y j )

(298)

T n, j,l = g 2 ( y j) ;

(299)

T i,1,l = g 3( xi ) ;

(300)

T i,m,l = g 4 ( xi ) ,

(301)

T1,j,l, Tn,j,l, Ti,1,l, Ti,m,l T(x, y, t) (x1, yj, tl), (xn, yj, tl),
(xi, y1, tl), (xi, ym, tl), .
(287),

T 2, j,l T 1, j,l
= g (y ) ;
1 j
x

(302)

T n, j,l T n 1, j,l
= g (y ) ;
j
2
x

(303)

T i,2,l T i,1,l
= g (x ) ;
3 i
y

(304)

T i,m,l T i,m1,l
= g (x ) .
4 i
y

(305)


(287),

94

T i, j,1 = g t (xi , y j) ,

(306)

Ti,j,1 T(x, y, t) (xi, yj, t1).


(287),

T i, j,2 T i, j,1
= g ( xi , y ) .
j
t
t

(307)

(283) ,

i, j , l C i , j , l

[k i, j,l (T i+1, j,l T i, j,l )k i1, j,l (T i, j,l T i 1, j,l )]

[k i, j,l (T i, j +1,l T i, j,l )k i, j 1,l (T i, j,l T i, j 1,l )] = f i, j,l

1
y

1
x

T i, j,l T i, j,l 1
t

i = 2,K, n 1 ; j = 2,K, m 1 ; l = 2,K, s ,

(308)

fi,j,l f(x, y, t) (xi, yj, tl).


,
nms.
(283) (288) (295)
(296) (297) (287) .
%
%
%
%
%
%



r(x,y)C(x,y)dT/dt-d/dx(k(x,y)dT/dx)- d/dy(k(x,y)dT/dy)=f(x,y)

/

function[x,y,t,T]= ...
termo_2d(t0,ts,s,x0,xn,n,y0,ym,m,r,c,k,f, ...
vt,gt1,v1,g1,v2,g2,v3,g3,v4,g4)
%
%
%
%

:
t0 - , c;
ts - , c;
x0 - , ;

95
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%

xn
y0
ym
n
m
s
r

vt -

gt1-

v1 -

g1 -

v2 -

g2 -

v3 -

g3 -

, ;
y, ;
y, ;
;
y;
t;
,
,
, , 'x+2*y', /^3;
,
,
, /( );
,
,
, /( );
,
,
, /^3;
,

(1 - , 2 - );
,
,
, /c;
,

= (1) (1 - , 2 - );

,
,
, /;
,

= (n) (1 - , 2 - );

,
,
, /;
,

y = y(1) (1 - , 2 - );

,
,
, /;

96
% v4 - ,
%

%
y = y(m) (1 - , 2 - );
% g4 -
%
,
%
,
%
, /.
%
%
%
%
%
%
%
%
%

:
- -
1 n;
y - - y
1 m;
t - -
1 s;
T -
n m x s.

%
if exist('t0')==0
t0=0;
end
if exist('ts')==0
ts=6;
end
if exist('s')==0
s=6;
end
if exist('x0')==0
x0=0;
end
if exist('xn')==0
xn=5e-2;
end
if exist('n')==0
n=10;
end
if exist('y0')==0
y0=0;
end
if exist('ym')==0
ym=8e-2;
end
if exist('m')==0

97
m=20;
end
if exist('r')==0
r='2e3';
end
if exist('c')==0
c='100';
end
if exist('k')==0
k='20';
end
if exist('f')==0
f='0';
end
if exist('vt')==0
vt=1;
end
if exist('gt1')==0
gt1='10*(sign(1e2*x-2)-sign(1e2*x-3)+ ...
sign(1e2*y-3)-sign(1e2*y-5))+300';
end
if exist('v1')==0
v1=1;
end
if exist('g1')==0
g1='300';
end
if exist('v2')==0
v2=1;
end
if exist('g2')==0
g2='300';
end
if exist('v3')==0
v3=1;
end
if exist('g3')==0
g3='300';
end
if exist('v4')==0
v4=1;
end
if exist('g4')==0
g4='300';
end

98
%
x=x0:(xn-x0)/(n-1):xn;
y=y0:(ym-y0)/(m-1):ym;
t=t0:(ts-t0)/(s-1):ts;

dx=x(2)-x(1);
dy=y(2)-y(1);
dt=t(2)-t(1);

% , ,
%
F=inline(f,'x','y');
R=inline(r,'x','y');
C=inline(c,'x','y');
K=inline(k,'x','y');
GT=inline(gt1,'x','y');
G1=inline(g1,'y');
G2=inline(g2,'y');
G3=inline(g3,'x');
G4=inline(g4,'x');
%
N=s*n*m;
% N x N,
% 0
a=zeros(N,N);
% -
% 1 x N, 0
b=zeros(1,N);
% ,
%
% vt, v1, v2, v3, v4
for i=1:n
for j=1:m
b(m*(i-1)+j)=GT(x(i),y(j));
if vt==1
a(m*(i-1)+j,m*(i-1)+j)=1;
elseif vt==2
a(m*(i-1)+j,m*(i-1)+j)=-1/dt;

99
a(m*(i-1)+j,n*m+m*(i-1)+j)=1/dt;
else
error('Parameter vt have incorrect value');
end
end
end
for l=1:s
for j=1:m
b(n*m*(l-1)+j)=G1(y(j));
if v1==1
a(n*m*(l-1)+j,n*m*(l-1)+j)=1;
elseif v1==2
a(n*m*(l-1)+j,n*m*(l-1)+j)=-1/dx;
a(n*m*(l-1)+j,n*m*(l-1)+m+j)=1/dx;
else
error('Parameter v1 have incorrect value');
end
b(n*m*(l-1)+m*(n-1)+j)=G2(y(j));
if v2==1
a(n*m*(l-1)+m*(n-1)+j,n*m*(l-1)+m*(n-1)+j)=1;
elseif v2==2
a(n*m*(l-1)+m*(n-1)+j,n*m*(l-1)+m*(n-1)+j)=1/dx;
a(n*m*(l-1)+m*(n-1)+j,n*m*(l-1)+m*(n-2)+j)= ...
-1/dx;
else
error('Parameter v2 have incorrect value');
end
end
for i=2:n-1
b(n*m*(l-1)+m*(i-1)+1)=G3(x(i));
if v3==1
a(n*m*(l-1)+m*(i-1)+1,n*m*(l-1)+m*(i-1)+1)=1;
elseif v3==2
a(n*m*(l-1)+m*(i-1)+1,n*m*(l-1)+m*(i-1)+1)= ...
-1/dy;
a(n*m*(l-1)+m*(i-1)+1,n*m*(l-1)+m*(i-1)+2)=1/dy;
else
error('Parameter v3 have incorrect value');
end
b(n*m*(l-1)+m*(i-1)+m)=G4(x(i));
if v4==1
a(n*m*(l-1)+m*(i-1)+m,n*m*(l-1)+m*(i-1)+m)=1;
elseif v4==2
a(n*m*(l-1)+m*(i-1)+m,n*m*(l-1)+m*(i-1)+m)=1/dy;
a(n*m*(l-1)+m*(i-1)+m,n*m*(l-1)+m*(i-1)+m-1)=...

100
-1/dy;
else
error('Parameter v4 have incorrect value');
end
end
end
% ,
%
for l=2:s
for i=2:n-1
for j=2:m-1
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-1)+j)=...
+R(x(i),y(j))*C(x(i),y(j))/dt+...
(K(x(i),y(j))+K(x(i-1),y(j)))/dx^2+...
(K(x(i),y(j))+K(x(i),y(j-1)))/dy^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*i+j)=...
-K(x(i),y(j))/dx^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-2)+j)=...
-K(x(i-1),y(j))/dx^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-1)+j+1)=...
-K(x(i),y(j))/dy^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-1)+j-1)=...
-K(x(i),y(j-1))/dy^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-2)+m*(i-1)+j)=...
-R(x(i),y(j))*C(x(i),y(j))/dt;
b(n*m*(l-1)+m*(i-1)+j)=F(x(i),y(j));
end
end
end
%
u=b/a';
%
%
%
%

-
n x m,

for l=1:s
for i=1:n
for j=1:m
T(i,j,l)=u(n*m*(l-1)+m*(i-1)+j);

101
end
end
end
% T(x,y,t)
for l=1:s
figure
surf(y,x,T(:,:,l))
xlabel('y, ')
ylabel('x, ')
zlabel('T, K')
grid on
colormap('cool')
axis([min(y) max(y) min(x) max(x) ...
min(min(T(:,:,1))) max(max(T(:,:,1)))])
pause(0.1)
M(l)=getframe;
end
figure
movie(M,10,3)

termo_2d.m /WORK,
MATLAB.
termo_2d :
termo_2d;
x=termo_2d;
[x,y]=termo_2d;
[x,y,t]=termo_2d;
[x,y,t,T]=termo_2d(t0,ts,s,x0,xn,n,y0,ym,m,r,c,k,f, ...
vt,gt1,v1,g1,v2,g2,v3,g3,v4,g4).

, , , .
.
(movie).
termo_2d
puass_2d.

102
,
termo_2d;
, :
- 0 ;
- 6 ;
- 6;
- xmin = 0;
- xmax = 5 ;
- 10;
- ymin = 0;
- ymax = 8 ;
- y 20;
- 2000 /3;
- 100 /();
- 20 /();
- () 0 /3,

T ( x , y ,t1) =10[sign(100x 2) sign(100x 3) +

+ sign(100y 3) sign(100y 5)] + 300

(309)

T ( xmin, y ,t ) = 300 K

(310)

T ( xmax, y ,t ) = 300 K

(311)

T ( x , y min,t ) = 300 K

(312)

T ( x , y max,t ) = 300 K

(313)

- , 1200 (10
20 6) (. 39).
20 , 1
( 8900 /3, 380 /(),
385 /() [12]) 10
,
300 , . 40, .

103

. 39.
: ) t = 0; ) t = 1 ; ) t = 2 ; ) t = 3 ; ) t = 4 ; ) t = 5 .

104
termo_2d
[x,y,t,T]=termo_2d(0,10,6,0,1e-2,6,0,20e-2,50,8900,...
380,385,0,1,'20*(sign(1e2*y-5)-sign(1e2*y-7)+...
sign(1e2*y-12)-sign(1e2*y-14))+300',2,0,2,0,1,...
300,1,300)
termo_2d.m .
- ,
1800 (6 50 6) ,
. 40.
5.3.
:

u = u + u
t x y
2

(314)

t ; , y ; u(x, y, t) , x = xmin, x = xmax, y = ymin, y = ymax [tmin, tmax].


[xmin, xmax]
:

x = {xi |i =1,2,...,n } ,

(315)

[ymin, ymax] y:

y = {y j| j =1,2,...,m } ,

(316)

[tmin, tmax] t:

t = {t l |l =1,2,...,s } .

(317)

, (315) (317), - :
G = {(xi = i, yj = jy, tl = lt), | i = 1, 2, , n, j = 1, 2, , m, l = 1, 2, , s }. (318)

105

. 40.
: ) t = 0; ) t = 2 ; ) t = 4 ; ) t = 6 ; ) t = 8 ; ) t = 10 .

106
()

u (x1 , y ,t ) = g1( y) ;

(319)

u ( xn , y ,t ) = g 2 ( y) ;

(320)

u (x , y1 ,t ) = g 3( x) ;

(321)

u ( x , y m,t ) = g 4 ( x) ,

(322)

1, xn xmin, xmax; y1, ym


ymin, ymax; g1(y), g2(y), g3(x), g4(x) .
()

u
x

=g

=g

=g

2 ( y)

(324)

3( x)

(325)

(326)

x , y1,t

u
y

(323)

xn, y ,t

u
y

x1, y ,t

u
x

1( y)

=g

4 ( x)

x , ym,t

u (x , y ,t1) = g t1(x, y) ;

(327)

u (x , y ,t s) = g t 2 (x, y) ,

(328)

t1 ; ts ; gt1(x, y),
gt2(x, y) .

107

u
t

=g

(329)

x , y ,t1

u
t

t1( x, y)

=g

t 2 ( x, y)

(330)

x , y ,t S

(318) ,
(331)
u = g (y ) ;
1, j, l

u n, j,l = g 2 ( y j) ;

(332)

ui,1,l = g 3( xi ) ;

(333)

ui,m,l = g 4 (xi ) ,

(334)

u1,j,l, un,j,l, ui,1,l, ui,m,l u(x, y, t) (x1, yj, tl), (xn, yj, tl),
(xi, y1, tl), (xi, ym, tl), .
(318),

u 2, j,l u1, j,l


= g (y ) ;
1 j
x
u n, j,l u n 1, j,l
x

=g

2 ( y j)

(335)

(336)

ui,2,l ui,1,l
= g (x ) ;
3 i
y

(337)

ui,m,l ui,m1,l
= g (x ) .
4 i
y

(338)


(318),

ui, j,1 = g t1(xi , y j) ;

(339)

ui, j, s = g t 2 (xi , y j) ,

(340)

ui,j,1 u(x, y, t) (xi, yj, t1).

108
(318),

ui, j,2 ui, j,1


t

=g

t1( xi , y j)

(341)

ui, j, s ui, j, s 1
= g ( xi , y ) .
j
t2
t

(342)

(314) ,

ui, j,l +1 2ui, j,l +ui, j,l 1 ui +1, j,l 2ui, j,l +ui 1, j,l
t

ui, j +1,l 2ui, j,l +ui, j 1,l


y

=0 ;

i = 2,K, n 1 ; j = 2,K, m 1 ; l = 2,K, s 1 .

(343)

,
nms.
(314) (319) (326) (327) (330) (318).
%
%
%
%


d2U/dt2=d2U/dx2+d2U/dy2

/

function[x,y,t,U]= ...
wave_2d(t0,ts,s,x0,xn,n,y0,ym,m, ...
vt1,gt1,vt2,gt2,v1,g1,v2,g2,v3,g3,v4,g4)
%
%
%
%
%
%
%
%
%

:
t0 - ;
ts - ;
x0 - ;
xn - ;
y0 - y;
ym - y;
n - ;
m - y;

109
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%

s - t;
vt1- ,
t(1)
(1 - , 2 - );
gt1-
t(1),
,
;
vt2- ,
t(s)
(1 - , 2 - );
gt2-
t(s),
,
;
v1 - ,

= (1) (1 - , 2 - );
g1 -
,
,
;
v2 - ,

= (n) (1 - , 2 - );
g2 -
,
,
;
v3 - ,

y = y(1) (1 - , 2 - );
g3 -
,
,
;
v4 - ,

y = y(m) (1 - , 2 - );
g4 -
,
,
.

110
%
%
%
%
%
%
%
%
%

:
- -
1 n;
y - - y
1 m;
t - -
1 s;
U -
n m x s.

%
if exist('t0')==0
t0=0;
end
if exist('ts')==0
ts=0.2;
end
if exist('s')==0
s=6;
end
if exist('x0')==0
x0=-1;
end
if exist('xn')==0
xn=1;
end
if exist('n')==0
n=18;
end
if exist('y0')==0
y0=-1;
end
if exist('ym')==0
ym=1;
end
if exist('m')==0
m=18;
end
if exist('vt1')==0
vt1=1;
end
if exist('gt1')==0
gt1='sin(4*x)-sin(4*y)';
end

111
if exist('vt2')==0
vt2=1;
end
if exist('gt2')==0
gt2='sin(4*y)-sin(4*x)';
end
if exist('v1')==0
v1=2;
end
if exist('g1')==0
g1='0';
end
if exist('v2')==0
v2=2;
end
if exist('g2')==0
g2='0';
end
if exist('v3')==0
v3=2;
end
if exist('g3')==0
g3='0';
end
if exist('v4')==0
v4=2;
end
if exist('g4')==0
g4='0';
end
%
x=x0:(xn-x0)/(n-1):xn;
y=y0:(ym-y0)/(m-1):ym;
t=t0:(ts-t0)/(s-1):ts;

dx=x(2)-x(1);
dy=y(2)-y(1);
dt=t(2)-t(1);

% , ,
%
GT1=inline(gt1,'x','y');
GT2=inline(gt2,'x','y');
G1=inline(g1,'y');
G2=inline(g2,'y');
G3=inline(g3,'x');

112
G4=inline(g4,'x');
%
N=s*n*m;
% N x N,
% 0
a=zeros(N,N);
% - 1 x N,
% 0
b=zeros(1,N);
%
%
%
%

,


vt1, vt2, v1, v2, v3, v4

for i=1:n
for j=1:m
b(m*(i-1)+j)=GT1(x(i),y(j));
if vt1==1
a(m*(i-1)+j,m*(i-1)+j)=1;
elseif vt1==2
a(m*(i-1)+j,m*(i-1)+j)=-1/dt;
a(m*(i-1)+j,n*m+m*(i-1)+j)=1/dt;
else
error('Parameter vt1 have incorrect value');
end
b(n*m*(s-1)+m*(i-1)+j)=GT2(x(i),y(j));
if vt2==1
a(n*m*(s-1)+m*(i-1)+j,n*m*(s-1)+m*(i-1)+j)=1;
elseif vt2==2
a(n*m*(s-1)+m*(i-1)+j,n*m*(s-1)+m*(i-1)+j)=1/dt;
a(n*m*(s-1)+m*(i-1)+j,n*m*(s-2)+m*(i-1)+j)= ...
-1/dt;
else
error('Parameter vt2 have incorrect value');
end
end
end

113
for l=1:s
for j=1:m
b(n*m*(l-1)+j)=G1(y(j));
if v1==1
a(n*m*(l-1)+j,n*m*(l-1)+j)=1;
elseif v1==2
a(n*m*(l-1)+j,n*m*(l-1)+j)=-1/dx;
a(n*m*(l-1)+j,n*m*(l-1)+m+j)=1/dx;
else
error('Parameter v1 have incorrect value');
end
b(n*m*(l-1)+m*(n-1)+j)=G2(y(j));
if v2==1
a(n*m*(l-1)+m*(n-1)+j,n*m*(l-1)+m*(n-1)+j)=1;
elseif v2==2
a(n*m*(l-1)+m*(n-1)+j,n*m*(l-1)+m*(n-1)+j)=1/dx;
a(n*m*(l-1)+m*(n-1)+j,n*m*(l-1)+m*(n-2)+j)= ...
-1/dx;
else
error('Parameter v2 have incorrect value');
end
end
for i=2:n-1
b(n*m*(l-1)+m*(i-1)+1)=G3(x(i));
if v3==1
a(n*m*(l-1)+m*(i-1)+1,n*m*(l-1)+m*(i-1)+1)=1;
elseif v3==2
a(n*m*(l-1)+m*(i-1)+1,n*m*(l-1)+m*(i-1)+1)= ...
-1/dy;
a(n*m*(l-1)+m*(i-1)+1,n*m*(l-1)+m*(i-1)+2)=1/dy;
else
error('Parameter v3 have incorrect value');
end
b(n*m*(l-1)+m*(i-1)+m)=G4(x(i));
if v4==1
a(n*m*(l-1)+m*(i-1)+m,n*m*(l-1)+m*(i-1)+m)=1;
elseif v4==2
a(n*m*(l-1)+m*(i-1)+m,n*m*(l-1)+m*(i-1)+m)=1/dy;
a(n*m*(l-1)+m*(i-1)+m,n*m*(l-1)+m*(i-1)+m-1)=...
-1/dy;
else
error('Parameter v4 have incorrect value');
end
end
end

114
% ,
%
for l=2:s-1
for i=2:n-1
for j=2:m-1
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-1)+j)=...
-2/dt^2+2/dx^2+2/dy^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*i+j)=-1/dx^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-2)+j)=...
-1/dx^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-1)+j+1)=...
-1/dy^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-1)+m*(i-1)+j-1)=...
-1/dy^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*l+m*(i-1)+j)=1/dt^2;
a(n*m*(l-1)+m*(i-1)+j,n*m*(l-2)+m*(i-1)+j)=...
1/dt^2;
end
end
end
%
u=b/a';
%
%
%
%

-

n x m x s,

for l=1:s
for i=1:n
for j=1:m
U(i,j,l)=u(n*m*(l-1)+m*(i-1)+j);
end
end
end
% U(x,y,t)
for l=1:s
figure
surf(y,x,U(:,:,l))

115
xlabel('y')
ylabel('x')
zlabel('U')
grid on
colormap('cool')
axis([min(y) max(y) min(x) max(x) min(min(min(U))) ...
max(max(max(U)))])
pause(0.1)
M(l)=getframe;
end
%
figure
movie(M,20,10)

wave_2d.m /WORK,
MATLAB.
wave_2d puass_2d
termo_2d :
wave_2d;
x=wave_2d;
[x,y]=wave_2d;
[x,y,t]=wave_2d;
[x,y,t,U]=wave_2d(t0,ts,s,x0,xn,n,y0,ym,m,...
vt1,gt1,vt2,gt2,v1,g1,v2,g2,v3,g3,v4,g4).


.
.
, , ,
:
- 0;
- 0.2;
- 6;
- xmin = -1;
- xmax = 1;
- 18;
- ymin = -1;
- ymax = 1;
- y 18.

116

u ( x , y ,t1) = sin(4x) sin(4 y) ;

(344)

u (x , y ,t1) = sin(4 y) sin(4x) ;

(345)

u
x

(347)

=0 ;

(348)

=0 ;

(349)

x , ymin,t

u
y

=0 ;
xmax, y ,t

u
y

(346)

xmin, y ,t

u
x

=0 ;

x , ymax,t

- , 1944 (18
18 6) (. 41).
wave_2d .

,
, , .
wave_2d
:
[x,y,t,U]=wave_2d;
[x,y,t,U]=wave_2d(t0,ts,s,x0,xn,n,y0,ym,m,...
vt1,gt1,vt2,gt2,v1,g1,v2,g2,v3,g3,v4,g4).

, y, t U
u(x, y, t) . .

117

. 41. u(x, y, t) :
) t = 0; ) t = 0.04; ) t = 0.08; ) t = 0.12; ) t = 0.16; ) t = 0.2.

118

, , , .
,
( ), .
, , , , , .
MATLAB , ,
.

119

1. .., .. . .: , 1976. 352 .


2. . : . . / . . . .:
, 1989. 280 .
3. .., .. . MATLAB. 3-
.: . . .: , 2001. 720 .
4. .., .. - . .: , 1991. 288
.
5. .. . .:
, 1973. 608 .
6. .., .., .., ..,
.. . .: . , 1976. 368 .
7. .., ..
. .: , 1959. 608 .
8. .. , : . . .: , 1983. 312 .
9. .. // . 2002. . 3. . 14 39.
10. .. MATLAB 5..
2- . . 1. .: -, 1999. 366 .
11. .. MATLAB 5..
2- . . 2. .: -, 1999. 304 .
12. / . .. . . 1. .: , 1967. 576 .

Оценить