Presentation is loading. Please wait.

Presentation is loading. Please wait.

數值方法 2008, Applied Mathematics NDHU 1 Ordinary differential equations II Runge-Kutta method.

Similar presentations


Presentation on theme: "數值方法 2008, Applied Mathematics NDHU 1 Ordinary differential equations II Runge-Kutta method."— Presentation transcript:

1 數值方法 2008, Applied Mathematics NDHU 1 Ordinary differential equations II Runge-Kutta method

2 數值方法 2008, Applied Mathematics NDHU 2 Runge Kutta method- motivation

3 數值方法 2008, Applied Mathematics NDHU 3 RK2: Secant method First step Euler rule Second step Euler rule

4 數值方法 2008, Applied Mathematics NDHU 4 Rule of RK2

5 數值方法 2008, Applied Mathematics NDHU 5 Rule of RK2

6 數值方法 2008, Applied Mathematics NDHU 6 RK2 method Function x=RK2(fa,a,b,fx) n=100; h=(b-a)/n; x(1)=fa; for i=2:n t=a+(i-1)*h; c=x(i-1); F1=fx(c,t); F2=fx(c+F1,t); x(i)=x(i-1)+(F1+F2)/2; end

7 數值方法 2008, Applied Mathematics NDHU 7 Demo_RK2 demo_RK2.exe demo_RK2.ctf demo_RK2.m

8 數值方法 2008, Applied Mathematics NDHU 8 RK2 and RK4

9 數值方法 2008, Applied Mathematics NDHU 9 Example >> demo_RK2 keyin derivative function of x and t:x+exp(t) a:0 x(a) :1 b:2 h:0.01 hold on; t=0:0.01:2; x=t.*exp(t)+exp(t); plot(t,x,'r')

10 數值方法 2008, Applied Mathematics NDHU 10 Exercise Implement the Runge-Kutta 2 method for solving an initial value problem Give an example to test your matlab codes

11 數值方法 2008, Applied Mathematics NDHU 11 Example >> demo_RK2 keyin derivative function of x and t:1+x.^2+t.^3 a:1 x(a) :-4 b:2 h:0.01 ans = 4.3695

12 數值方法 2008, Applied Mathematics NDHU 12 Exercise Implement the RK4 method for solving an IVP problem

13 數值方法 2008, Applied Mathematics NDHU 13 Demo_RK4 demo_RK4.m >> demo_rk4 keyin derivative function of x and t:1+x.^2+t.^3 a:1 x(a) :-4 b:2 h:0.01 ans = 4.3712

14 數值方法 2008, Applied Mathematics NDHU 14 Exercise Apply the Euler method, the Taylor-4 method, the RK2 method and the RK4 method to solve the following IVP problem x'=1+x2 +t3, x(1)=-4, x(2)=?

15 數值方法 2008, Applied Mathematics NDHU 15 Matlab codes for time series data Eric's Home Page

16 數值方法 2008, Applied Mathematics NDHU 16 Chaos time series

17 數值方法 2008, Applied Mathematics NDHU 17 Exercise Apply the RK4 method to solve the following IVP problem

18 數值方法 2008, Applied Mathematics NDHU 18 mg1.m

19 數值方法 2008, Applied Mathematics NDHU 19 MG mg.m

20 數值方法 2008, Applied Mathematics NDHU 20 >> mg >> n=length(x); >> plot(1:1:n,x) a=0.2,c=10,b=0.1, mg.m

21 數值方法 2008, Applied Mathematics NDHU 21 >> load MG17.dat >> n=length(MG17); >> plot(1:1:n,MG17)

22 數值方法 2008, Applied Mathematics NDHU 22 MG30

23 數值方法 2008, Applied Mathematics NDHU 23

24 數值方法 2008, Applied Mathematics NDHU 24 Mackey-Glass demo_mg.m >> demo_mg Mackey Glass generator tau:30 Series length:360000

25 數值方法 2008, Applied Mathematics NDHU 25 Tau=3 A stable fixed point attractor

26 數值方法 2008, Applied Mathematics NDHU 26 Tau=10 A stable limit cycle attractor

27 數值方法 2008, Applied Mathematics NDHU 27 Tau=15 Period of limit cycle doubles

28 數值方法 2008, Applied Mathematics NDHU 28 Tau=17

29 數值方法 2008, Applied Mathematics NDHU 29 tau=30 Chaotic attractor characterized by tau


Download ppt "數值方法 2008, Applied Mathematics NDHU 1 Ordinary differential equations II Runge-Kutta method."

Similar presentations


Ads by Google