Anda di halaman 1dari 7

5 Model Kontinu.

nb

B A B

Model Kontinu
Bagian ini membahas konsep-konsep permodelan bagi fenomena-fenomena yang mengalami
dinamika secara kontinu. Formulasi matematik utama yang digunakan adalah persamaan
diferensial. Topik-topik yang dibahas meliputi: analisis kompartemen untuk model dinamik,
sistem dinamik, analisis kualitatif model, konstruksi model kontinu untuk berbagai contoh kasus.
Solusi model beserta visualisasinya diberikan dalam bentuk solusi analitik maupun numerik
dengan bantuan Mathematica.

Model Kompartemen
Banyak fenomena - fenomena fisik/non - fisik yang dapat direpresentasikan dengan model kompartemen. Model
kompartemen yang paling sederhana melibatkan sebuah kompartemen (misal : ruang, tangki) dan laju perbubahan
suatu kuantitas (masa, volume, energi) terhadap waktu akibat interaksi dengan lingkungannya.
Misalkan suatu black-box R mengandung kuantitas fisik yang mengalami dinamika terhadap waktu t, QHtL, dapat
digambarkan sebagai:
kuantitas masuk R Q HtL kuantitas keluar R

Dalam hal ini berlaku hukum kekekalan masa:


dQ
dt

= laju input - laju output

Model dengan Sistem Persamaan Diferensial


Misalkan terdapat n peubah state, x1 , x2 x3 , , xn yang laju perubahannya masing-masing mengikuti hubungan

x1 = f1 Hx1 , x2 , , xn L

x2 = f2 Hx1 , x2 , , xn L
=

xn = fn Hx1 , x2 , , xn L

dengan xi =

dxi
dt

Bila bentuk fungsi fi linear dengan koefisien konstan, maka (1) dapat dinyatakan dengan notasi matriks:

(1)

5 Model Kontinu.nb

x1

x2

xn

a11 a12 a1 n
a21 a22 a2 n

an1 an2

ann

x1
x2

xn

(2)

atau
x = Ax

(3)

Misalkan matriks A memiliki n buah nilai eigen yang berbeda maka solusi dari (3) adalah:
x = c1 l1 v1 + c2 l2 v2 + + cn ln vn

(4)

dengan Hli , vi ) merupakan pasanga nilai eigen dan vektor eigen yang bersesuaian, dan ci merupakan konstanta yang
dapat ditentukan nilainya berdasarkan masalah nilai awal..

Komputasi
Tools Mathematica: DSolve, NDSolve

DSolve@x '@tD == r x@tD H1 x@tD KL, x@tD, tD

::x@tD

r t+K C@1D

1 +

r t+K C@1D

>>

Clear@x, t, DerivativeD;

Here is an example using DSolve to find the constant of integration. Notice the two equations (the differential equation
and the intial condition) grouped in braces.
DSolve@8x '@tD == 1.3 x@tD, x@0D == 20<, x@tD, tD

99x@tD 20

1.3 t

==

Mathematica reports its solution as a list. To extract the solution, name the list something (like solution) and use the
procedure below. The result is a function which can be used in all the ways any function is used, such as plotting.
solution = DSolve@8x '@tD == 1.3 x@tD, x@0D == 20<, x@tD, tD

99x@tD 20

1.3 t

==

x@t_D = x@tD . solution@@1DD

20

1.3 t

5 Model Kontinu.nb

Plot@x@tD, 8t, 0, 5<D


8000

6000

4000

2000

Next we do an example with NDSolve. Notice the only difference is instead of t, we require {t, tmin, tmax}. Of
course there can be no symbolic constants and the inital condition is necessary. If previous solutions involving the
variable x and t have been performed this session, it is necessary to Clear them. The word Derivative causes both x
and x' to be cleared. Notice we need to do the same trick to get a solution which is useable as a function.
Clear@x, t, DerivativeD;

solution = NDSolve@8x '@tD == 1.3 x@tD H1 x@tD 100L ^ 5, x@0D == 20<, x@tD, 8t, 0, 20<D

88x@tD InterpolatingFunction@880., 20.<<, <>D@tD<<


x@t_D = x@tD . solution@@1DD

InterpolatingFunction@880., 20.<<, <>D@tD


Plot@x@tD, 8t, 0, 20<D
60

50

40

30

10

15

20

The Options command tells us the options a function has. Here are the options for NDSolve. Notice if we desire some
control over the numerical solving process, we can set options accordingly.
Options@NDSolveD

:AccuracyGoal Automatic, Compiled Automatic,


DependentVariables Automatic, EvaluationMonitor None,
1
,
InterpolationOrder Automatic, MaxStepFraction
10
MaxSteps 10 000, MaxStepSize Automatic, Method Automatic,
NormFunction Automatic, PrecisionGoal Automatic,
SolveDelayed False, StartingStepSize Automatic,
StepMonitor None, WorkingPrecision MachinePrecision>

5 Model Kontinu.nb

Here we specify that the algorithm used is Runge-Kutta. For more details, see Wolfram's Mathematica Book.
Clear@x, t, DerivativeD;

solution = NDSolve@8x '@tD == 1.3 x@tD H1 x@tD 100L ^ 5, x@0D == 20<,


x@tD, 8t, 0, 20<, Method ExplicitRungeKuttaD

88x@tD InterpolatingFunction@880., 20.<<, <>D@tD<<


x@t_D = x@tD . solution@@1DD

InterpolatingFunction@880., 20.<<, <>D@tD


Plot@x@tD, 8t, 0, 20<D
60

50

40

30

10

15

20

Solusi Sistem Persamaan Diferensial Linear Orde 1 dengan Koefisien


Konstan
Masalah nilai awal
We are solving a problem of the form X'=MX with the initial value X(0) known
M = 88.24, .1, .04<, 8.2, .2, .15<, 8.05, .1, .2<<

880.24, 0.1, 0.04<, 80.2, 0.2, 0.15<, 80.05, 0.1, 0.2<<


X0 = 812 000, 10 000, 8000<

812 000, 10 000, 8000<

Nilai eigen dan vektor eigen


80.379429, 0.260065, 0.000506709<
Eigenvalues@MD

To find numeric values of the eigenvalues use the N[] function.

80.379429, 0.260065, 0.000506709<


N@%D

5 Model Kontinu.nb

880.379429, 0.260065, 0.000506709<,


880.491671, 0.811672, 0.315355<,
80.543698, 0.215379, 0.811175<,
80.404402, 0.772983, 0.488831<<<
eigenlist = Eigensystem@MD

Define the eigenvalues and eigenvector as the appropriate components of eigenlist. This can be done by entering them
directly, but this "automated" approach makes it easy to reuse the code for other systems.
l1 = eigenlistP1TP1T
l2 = eigenlistP1TP2T
l3 = eigenlistP1TP3T

0.379429
0.260065
0.000506709
v1 = eigenlistP2TP1T
v2 = eigenlistP2TP2T
v3 = eigenlistP2TP3T

80.491671, 0.811672, 0.315355<


80.543698, 0.215379, 0.811175<

80.404402, 0.772983, 0.488831<


Define a vector of arbitrary constants.
c = 8c1, c2, c3<;

Notice that multiplying a list by a function distributes the function across the list.
E2 t v1

90.491671

2 t

, 0.811672

2 t

2 t

, 0.315355

Define the matrix .


Phi@t_D = TransposeA9El1 t v1, El2 t v2, El3 t v3=E

990.491671
90.811672

90.315355

0.379429 t
0.379429 t

, 0.543698

, 0.215379

0.379429 t

, 0.811175

0.260065 t
0.260065 t
0.260065 t

, 0.404402

0.000506709 t

, 0.772983

0.000506709 t

, 0.488831

0.000506709 t

=,

=,
==

5 Model Kontinu.nb

Solusi umum
90.491671 c1
Phi@tD.c

0.379429 t

0.260065 t

0.543698 c2
0.404402 c3 0.000506709 t ,
0.811672 c1 0.379429 t 0.215379 c2 0.260065 t
0.772983 c3 0.000506709 t , 0.315355 c1 0.379429 t +
0.811175 c2 0.260065 t 0.488831 c3 0.000506709 t =

Solution masalah nilai awal


85822.89, 3324.01, 18 125.<
cspec = Inverse@Phi@0DD.X0

92862.94

Phi@tD.Simplify@cspecD
0.379429 t

+ 1807.25

0.260065 t

0.000506709 t

+ 7329.8

4726.28
+ 715.923
+ 14 010.4
,
1836.27 0.379429 t 2696.35 0.260065 t + 8860.07 0.000506709 t =
0.379429 t

0.260065 t

0.000506709 t

soln = Simplify@%D

92862.94

0.379429 t

+ 1807.25

0.260065 t

0.000506709 t

+ 7329.8

4726.28
+ 715.923
+ 14 010.4
,
0.379429 t
0.260065 t
0.000506709 t
1836.27
2696.35
+ 8860.07
=
0.379429 t

0.260065 t

0.000506709 t

The functions x, y, and z are defined to be the appropriate components of soln.


x@t_D = solnP1T
y@t_D = solnP2T
z@t_D = solnP3T

2862.94
4726.28
1836.27

0.379429 t

+ 1807.25

0.379429 t
0.379429 t

+ 715.923

2696.35

0.260065 t

+ 7329.8

0.260065 t
0.260065 t

0.000506709 t

+ 14 010.4

+ 8860.07

0.000506709 t
0.000506709 t

5 Model Kontinu.nb

Plot kurva solusi

Plot@8x@tD, y@tD, z@tD<, 8t, 0, 100<D


14 000
13 000
12 000
11 000
10 000
9000
8000

20

40

60

80

100

ParametricPlot3D@8x@tD, y@tD, z@tD<, 8t, 0, 20<, ViewPoint 82.228`, 1.932`, 1.659`<D

8600
8400
8200
8000
13 500

8000
9000
13 000
12 500

10 000
12 000