Skip to content

Instantly share code, notes, and snippets.

@myjr52
Last active August 29, 2015 14:13
Show Gist options
  • Save myjr52/a7eac965053594e39112 to your computer and use it in GitHub Desktop.
Save myjr52/a7eac965053594e39112 to your computer and use it in GitHub Desktop.
import scipy as sp
from scipy.integrate import odeint
import matplotlib.pyplot as plt
# 마분방정식이 적분기 부르기 전에 정의되어야 합니다.
def RLC_eqn(x, t):
R, L, C = [1, 1, 1]
u = 1
x1, x2 = x
xdot = [ 1/C*x2,
-1/L*x1 -R/L*x2 + 1/L*u]
return xdot
# 시간간격과 초기조건 설정
t = sp.linspace(0,10,100)
init = [0,0]
# 수치 적분과 결과 그림 그리기
x = odeint(RLC_eqn, init, t)
plt.plot(t,x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment