我正在研究一个电气工程项目,我们将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是什么意思?我在文档中找不到任何关于它的信息。
感谢您对此的任何见解。我希望这不是一个懒惰的问题,但我认为完全理解这将帮助我很多。