Professional Documents
Culture Documents
SWWW
SWWW
To
MATLAB
arijm
ap
kai
algorjmou
shmeisei
ja
ap
to
gia
thn
arijmhtik
perigryoume
ma
ap
sumbouleutetai
merik
sugkekrimna
to
aut
egqeirdio
qoun
aut
qrsh
ete
eplush
ti
sunjwn
mejdou ,
MATLAB
tou
megalterh
txh
diaforikn
ode23
thn
trpo
akrbeia
ete/kai
stw
y0
2R
(
Zhtetai
: [a; b R
= f (t; y(t));
y (a) = y0 :
sunrthsh
tra,
ti
y 0 (t)
(1)
gia
th
ode23
lsh
shmeisei
qei tra
tou
(1),
thn
ektmhsh
majmato
gi
na
tou
topiko
akma
sumbolzoume ed me
1
!R
ti
tou
kai
Se
uploipe
enai
meglo
aut
gia
: [a; b Rm
ti
mejdou ,
anlogo
katllhle
all
kampte
!R
mia
ttoia ste
Runge{Kutta
sflmato
trpo
s1 ; s2 ; s3
enai
exissewn.
na
t b;
tou
stdia (ta
Gia
qrsh
diaforik
exissei
.
Ma
endiafrei to akloujo prblhma arqikn timn:
parqei
autmath
kai
thn
txh
epilog
epilog
tou
do,
tou
antstoiqa,
bmato
bmato ).
(dete
mjodo
= f (tn; yn );
s1
= f (tn + ; yn + s1 );
2
2
3h n 3h
n
s 3 = f (t +
;y +
s );
4
4 2
h
y n+1 = y n + (2s1 + 3s2 + 4s3 ):
9
s2
s4
algrijmo
ektmhsh,
detero
y n+1
xekinei
ap
, tou bmato .
stdio
th
to
Stqo
jy
+1
y
enai
+1
na
pli
Sqma 1.
To
upologsoume
y (t +1 )j
n
kai
mi
mjodo tou
morf (1).
ode23
Sthn
tou
sto
72
arqik
Euler
klsh
all
s1
prosggish
mia
epmeno
me
= f (tn ; yn )
Euler
3h=4
y n+1
mikr
bma.
th
gnei apodekt h
Matlab
kai
mi
me bma
bma
telik
arqik
h=2
To
ektmhsh
enai
sqsei
9s4 ):
posthta
9s4 ):
lsh
stajer.
'An
Diaforetik,
sto
qrno
j j
n
aporrptoume
tn+1
tte
thn
H sunrthsh
topik
mia
pou
proqwrme
upodiplasizoume to bma
dnetai ap ti
mejdou enai
fanetai sto
ma
ektmhsh
th
sflmato
= f (tn+1; yn+1 );
(tn ; yn )
shmeo
aut
72
topiko
klsei ,
ste
tou
prosggish
y n+1
tn
+h
deqmaste
ektmhsh
+1
tsi
thn
+1
H diadikasa
aploster th
morf, h
sunrthsh
ode23
kaletai w
s2
s1
s1
yn
tn
tn
tn+h/2
s3
s3
s2
tn+3h/4
tn
Sqma 1:
tn+h
tn
algrijmo th
sunrthsh
ode23
An
ap to
mqri to
dinusma
na
doje
stlh
ete
sunrthsh
th
me
san
ode23
lsh sth
tte
ti
tim
inline
1.
ode23
pou
oloklhrnei
Y0
antistoiqon
sunrthsh
ete
na
T(i)
sth
th
diaforik
sunrthsh
se
na
exswsh
ODEFUN(T,Y)
f (t; y )
M{le
sunrthsh
oriste
qronik stigm
Pardeigma
, me arqik tim
tou
sunrthsh
(akoloujon
problmato
(1)
prpei na epistrfei na
. H gramm
ODEFUN
mpore
paradegmata).
tou pnaka
periqei
Gia na lsoume to
3y; 0 t 1;
y 0 (t)
= 4t
y (0) = 2;
prth
ap
sunrthsh
lsh
sto
ti
enai
parapnw
pol
disthma
apl
[0; 1
entol
thn
An
orzei
grfoume
den
ma
to
san
dex
mlo
inline
endiafroun
th
diaforik
sunrthsh.
ta
diansmata
exswsh .
teleutaa
kai
pou
Epeid
entol
ed
sqedizei
epistrfei
h
th
ode23
to
Matlab
grafik
sunrthsh
ja
sqedisei
parstash
se
na
pou
M{le
lsh
en
lnei
fanetai
th
sto
Sqma
me to
noma
f.m
th
pou
diaforik exswsh.
2.
Enallaktik,
ja
An
na periqei ti entol
la
pgan
mporosame
kal,
na
ja
dete
gryoume
th
1.5
0.5
0.1
0.2
Sqma 2:
0.3
0.4
H lsh
0.5
0.6
ode23
th
0.7
gia to
0.8
0.9
Pardeigma 1.
thn
entol
1.
2.
3.
4.
5.
1.
Lste
f (t; y )
=0
f (t; y )
=t
f (t; y )
=y
f (t; y )
= 1=(1
f (t; y )
= 2y
to
disthma
[0; 10
me
y (0)
=1
thn
Pardeigma
2.
3t)
y2
akrib lsh.
Se
two-body problem
tou
sto
Sugkrnete me
).
barutik
lxh
smato
grw
aut
to
Aut
ap
pardeigma
perigrfei
na
kat
ja
thn
pol
lsoume
troqi
bartero
to
en
sma
legmeno
smato
B.
tte
u00 (t)
v 00
=
(t) =
u(t)=r 3 (t);
v (t)=r 3 (t);
An
<<prblhma
A
ktw
(u(t); v(t))
twn
ap
enai
do
thn
oi
swmtwn>>
epdrash
th
suntetagmne
r (t )
pou
ssthma
u2 (t) + v 2 (t)
exissewn prth
Mporome
na
gryoume
to
parapnw
ssthma
exissewn
san
na
txh an jsoume
2 u(t) 3
6 v(t) 77
y (t) = 6
4 5
u 0 (t )
v 0 (t)
y (t)
ikanopoie tte
th diaforik exswsh
2
6
y (t) = 6
4
0
Grfoume sto
M{le twobody.m
3 2
77 66
5=4
u0 (t)
v 0 (t )
u(t)=r 3 (t)
v (t)=r 3 (t)
y3 (t)
y4 (t)
y1 (t)=r 3 (t)
y2 (t)=r 3 (t)
3
77
5
ti entol
ode23
sunjw :
plot
lei
(0; 1)
ti
to
brsketai
gi
=0
sto
(0; 0)
(1; 0)
.
2 [0; 2
kai
shmeo
kai
to
dinusma
th
taqtht
tou
Allxte to dinusma arqikn timn kai parathrste pw allzei h troqi tou smato
grw ap to
H
sma
sma
pw th stajer
OPTIONS
B.
ode23
sunrthsh
epitrpei
ston
qrsth
na
allxei
orismne
paramtrou
tou
algorjmou,
VALUE2
twn
. . . ,
ODESET
antstoiqa.
tou
Matlab
Merik qrsime
paramtrwn sumbouleutetai
RelTol
Sqetik
dialxei to
mgisto
bma th
to
parmetroi enai
egqeirdio qrsh
sflma.
mejdou tsi
Jetik
ste
to
tou
stajer
sflma
oi
NAME1 NAME2
,
aklouje (gia
Matlab
me
ton
plrh
VALUE1
katlogo
):
tim
e(i)
, . . . , ti tim
1.0e-3
gia th
ode23
sunistsa
yi (t)
prospaje
th
lsh
na
na
ikanopoie
AbsTol
Apluto
mgisto
sflma.
Jetik stajer
dinusma me
mko
kai tim
1.0e-6
Refine
Jetik
akraia
stajer
me
tim
na.
Aut
stajer
auxnei
thn
puknthta
twn
shmewn pou qrhsimopoiontai sth grafik parstash th lsh kat to dosmno suntelest.
InitialStep
MaxStep
to
Mgisto
na dkato tou
Pardeigma
y (0)
3.
epitrept
mkou tou
Lnoume
to
bma.
An
den
teje
ap
ton
qrsth
tte
aut
upologzetai
prblhma
arqikn
timn
=1
y 0 (t)
= 3t
4y 0
,
t1
me
arqik
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
Sqma 3:
0.1
0.2
san
diastmato oloklrwsh .
0.3
0.4
0.5
grafik parstash
th
0.6
lsh
0.7
tou
0.8
0.9
Paradegmato 3.
tim