11-2 ODE ?令?本??

bϥ ODE OɡAڭ̥NnDѪ ODE ܦ@Ө禡A禡J t]ɶ^ y]AܼơAState Variables^AXh dy]AܼƪLȡ^CpG ODE 禡]ΤS ODE ɮס^ɦW odeFile.mAhڭ̩Is ODE O榡pUG

[t, y] = solver ('odeFile', [t0, t1], y0);

䤤 [t0, t1] Onɶ϶Ay0 N_l]Initial Conditions^Asolver OeҦCU ODE OAt OXɶVqAy hOAܼƦVqC

H van der Pol L{ҡA{G

$$y''-\mu (1-y^2)y'+y=0$$

ڭ̥NƦзǮ榡AO $y_1=y$A$y_2=y'$AhWzL{iHgӤ@L{G

$$ \left\{ \begin{array}{rcl} y_1' & = & y_2 \\ y_2' & = & \mu (1-y_1^2)y_2-y_1\\ \end{array} \right. $$

ؼзǮ榡iΦVqӪܦ@ƪƾǦG

$$\vec{y}' = \vec{F}(\vec{y}, t)$$

䤤 $\vec{y}'$ @VqANAܼơCϥΦзǮ榡Að] $\mu=1$Aڭ̪ ODE ɮס]vdp1.m^iܦpUG

11-`L{/vdp1.mfunction dy = vdp1(t, y) mu = 1; dy = [y(2); mu*(1-y(1)^2)*y(2)-y(1)];

@F ODE ɮסAڭ̧YiΫez ODE OӥѡCb $\mu=1$ ɡAvan der Pol {ëD Stiff tΡA]Aڭ̥i ode45 ӨDѡA²檺@kANOϥΦOӵeXnGAdҦpUG

Example 1: 11-`L{/odeBasic01.mode45('vdp1', [0 25], [3 3]');

䤤 [0, 25] Nnɶ϶A[3 3] hN_l]HVqӪܡ^CѩSXܼơAҥHWz{浲AMATLAB u|eXAܼƹɶϧΡApWϡCYnonұoAܼƤιɶAiH[WXܼƥHooǸơAdҦpUG

Example 2: 11-`L{/odeGetData01.m[t, y] = ode45('vdp1', [0 25], [3 3]'); plot(t, y(:,1), t, y(:,2)); xlabel('Time t'); ylabel('Solution y(t) and y''(t)'); legend('y(t)', 'y''(t)');

ڭ̤]iHeX $y(t)$ $y'(t)$ bۦ쥭]Phase Plane ^BʱpAҦpG

Example 3: 11-`L{/odephasePlot01.m[t, y] = ode45('vdp1', [0 25], [3 3]'); plot(y(:,1), y(:,2), '-o'); xlabel('y(t)'); ylabel('y''(t)');

bWҤA $\mu$ ȶVӶVjɡAvan der Pol {Nܦ@ Stiff tΡAɭYnѦ{ANαMI Stiff tΪOC

Aڭ̱N $\mu$ ȧ令 1000A ODE ɮ׭ngpU]vdp2.m^G

11-`L{/vdp2.mfunction dy = vdp2(t, y) mu = 1000; dy = [y(2); mu*(1-y(1)^2)*y(2)-y(1)];

ɧYiαMI Stiff tΪ ODE OAҦp ode15sAӨDѦtΨç@ܡApUG

Example 4: 11-`L{/ode15s01.m[t, y]= ode15s('vdp2', [0 3000], [2 1]'); subplot(2,1,1); plot(t, y(:,1), '-o'); xlabel('Time t'); ylabel('y(t)'); subplot(2,1,2); plot(t, y(:,2), '-o'); xlabel('Time t'); ylabel('y''(t)'); % `N޸u'vШϥ

ѤWϥiݥXA$y'(t)$ ܤƬ۷@P]WL $\pm 1000$^AoNO Stiff tΪSC

YneXGۦϡAiHϥΤUCdҡG

Example 5: 11-`L{/ode15s02.m[t, y]= ode15s('vdp2', [0 3000], [2 1]'); subplot(1,1,1); plot(y(:, 1), y(:, 2), '-o'); xlabel('y(t)'); ylabel('y''(t)')

YnͦbYǯSwɶIAܼƭȡAhڭ̩Is ODE O榡i令G

[t, y] = solver('odeFile', [t0, t1, ..., tn], y0);

䤤 [t0, t1, ..., tn] YOSwɶIҧΦVqAŪ̦ۦոլݡC


MATLAB{]pGig