Intuition Concept

์ปดํ“จํ„ฐ๋Š” ์ด์‚ฐ์ ์ธ ๊ฐ’์—์„œ ์ž‘๋™ํ•˜๋Š” ๊ธฐ๊ณ„์ž…๋‹ˆ๋‹ค.ย 

์šฐ๋ฆฌ์˜ ์ •์‹ ์„ธ๊ณ„์—์„œ ์ด์ƒ์ ์ธ ์„ ์€ ์กด์žฌํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ํ˜„์‹ค์—์„œ๋Š” ๊ฐ€์‚ฐ์ ์ธ ์ ์˜ ์ง‘ํ•ฉ์ด ๊ฒฐ๊ตญ ์„ ์ด๊ฒ ์ฃ .ย 

์—ฐ์†์ ์ธ ์„ธ๊ณ„์—์„œ ์ •์˜๋œ ํ•ด์„์  ๋ฏธ๋ถ„๋ฐฉ์ •์‹์˜ ํ’€์ด ๋ฐฉ๋ฒ•์€ ์ปดํ“จํ„ฐ์—์„œ ์ ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.ย 

๊ทธ๋ž˜์„œ ์šฐ๋ฆฌ๋Š” ์ด์‚ฐ์ ์ธ ์„ธ๊ณ„์—์„œ ๋ฏธ๋ถ„๋ฐฉ์ •์‹์˜ ํ•ด๋ฅผ ๊ฒ€์ถœํ•  ์ˆ˜ ์žˆ๋Š” ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ODE์˜ ํ’€์ด๋Š” ์ƒ๋žตํ•˜๊ณ  ๋ฏธ๋ถ„๋ฐฉ์ •์‹์˜ ๊ผด์—์„œ ๋ถ€ํ„ฐ ์ƒ๊ฐํ•ด๋ณด์•„์š”.

(c = ํ•ญ๋ ฅ๊ณ„์ˆ˜)
๋–จ์–ด์ง€๋Š” ๋ฌผ์ฒด๊ฐ€ ์žˆ์„ ๋•Œ, ์ข…๋‹จ์†๋„์— ๊ด€ํ•œ ๋ฏธ๋ถ„ ๋ฐฉ์ •์‹์ž…๋‹ˆ๋‹ค.
์ง๊ด€์ ์œผ๋กœ ๋ณด๋ฉด LHS = ๊ฐ€์†๋„(์†๋„์˜ ๋ณ€ํ™”)๋Š”,
RHS = ๋–จ์–ด์ง€๋Š” ์ค‘๋ ฅ์˜ ๊ฐ€์†๋„ - ํ•ญ๋ ฅ๊ณ„์ˆ˜ * ์†๋„ ๋กœ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ๋•Œ, LHS๋Š” ์†๋„์˜ ํ•จ์ˆ˜๋ผ๊ณ  ๋ณผ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”.

์—ฌ๊ธฐ์„œ Slope๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ •๋ฆฌํ•˜๋ฉด, ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Function

์ ๋ถ„์˜ ๊ทผ์‚ฌ๋ฐฉ๋ฒ•์ด ๊ต‰์žฅํžˆ ๋งŽ์•˜๋“ฏ์ด ODE๋„ ๊ทผ๋ณธ์ ์œผ๋กœ ๊ทผ์‚ฌํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๊ธฐ์— ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.

ODE ๊ทผ์‚ฌํ•จ์ˆ˜๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์—…๋ฐ์ดํŠธ ๋ฐฉ์‹์œผ๋กœ ๊ฐ’์„ ์–ป์–ด๋‚ด๊ธฐ ๋•Œ๋ฌธ์— ๊ฒฝ๊ณ„์กฐ๊ฑด์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.ย 

์ด ๋ถ€๋ถ„์€ ํ•ด์„์ ์œผ๋กœ ํ’€๋”๋ผ๋„ ํ•ด์˜ ์œ ์ผ์„ฑ์„ ํŒ๋‹จํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•œ ๋ถ€๋ถ„์ž…๋‹ˆ๋‹ค.

Solve the ODE [t y] = solver_name(ODEfunc,๊ตฌํ• t์˜๋ฒ”์œ„,y0) (where y0 at t0)

Example1

1 < t < 3 ์˜ ๋ฒ”์œ„๋‚ด์—์„œ ๋‹ค์Œ์„ ํ’€์–ด๋ผ. (B.C y = 4.2 at t = 1)

์œ„์˜ ์›๋ฆฌ๋ฅผ ๋งŒ์กฑํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด๋ณด์ž.

function[t, y] = ode_self(n, initial, final, f, y0) 
	dt = (final-initial)/n; 
	t(1) = initial; 
	y(1) = y0;     
	for i = 1: n     
		t(i+1) = t(i) + dt;     
			y(i+1) = y(i) + dt * f(t(i),y(i));    
	end 
end

๊ทธ๋ฆฌ๊ณ  ์‹คํ–‰ํ•ด๋ณด์ž.

์‹คํ–‰์ฝ”๋“œ
dydt = @(t,y)(t^3 -2*y)/t 
[t,y] = ode_self(100, 1, 3, dydt, 4.2) 
 
plot(t,y)

ODE45๋กœ๋„ ํ’€์–ด๋ณด์ž.

dydt = @(t,y)(t^3 -2*y)/t 
[t,y] = ode45(dydt, [1:0.01:3], 4.2) 
 
plot(t,y)

๊ฐ™๊ฒŒ ๊ทธ๋ ค์ง€๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

Example2

x์™€ v์™€์˜ ๊ด€๊ณ„๋ฅผ ์›ํ•˜๋ฏ€๋กœ ์•ฝ๊ฐ„์˜ ์กฐ์ž‘์„ ๊ฐ€ํ–ˆ๋‹ค.

K = 30 
m = 1500 
v0 = 90*1000/3600 
% ๋‹จ์œ„ ๋ณ€ํ™˜ 
dvdx = @(x,v)(-1)*(K/m)*(v^2)*(x+1)^3 
range_x = [0:0.001:3] 
[x, v] = ode45(dvdx,range_x,v0)  

plot(x,v) 
xlabel('x') 
ylabel('v')