我正在研究一個電氣工程項目,我們將RLC電路中的電容上的電壓繪製爲時間的函數。我在以下教程中使用我的代碼:Python-ODE for RLC Circuit。我的代碼功能齊全,但我只想更好地理解用戶定義的函數和SciPy集成函數的工作原理。我已閱讀文檔,但我仍然有一些具體問題。這裏是我的代碼:這個用戶定義的函數如何與scipy集成odeint?
from scipy.integrate import odeint # for integrating ode
import matplotlib.pyplot as plt # for plotting commands
import numpy as np #For loadtxt and linspace modules
R,L,C,tl,numplot = np.loadtxt('UserInput_RLC_Values.txt',unpack=True)
def RLC(A,t):
Vc,m=A
V = 2.0 #voltageSource
res=[m,(V-Vc-(m*R*C))/(L*C)]
return res
time = np.linspace(0.0,tl,numplot)
vc,m = odeint(RLC,[0.0,0.0],time).T
這裏是我的問題:
- 什麼樣的作用是參數值A和T的演奏在功能RLC?爲什麼將A分配給Vc(電容器電壓)和m(v'的虛擬變量)?甚至用過嗎?
- 當我在odeint模塊裏面調用RLC函數時,爲什麼沒有任何參數?
- odeint模塊末尾的.T是什麼意思?我在文檔中找不到任何關於它的信息。
感謝您對此的任何見解。我希望這不是一個懶惰的問題,但我認爲完全理解這將幫助我很多。