python - 离散到连续时间传递函数
问题描述
我实现了一个类来识别 Python 中的 ARX 模型。下一步是基于 LQR 计算最优 PID 参数。显然需要一个连续的时间模型,我有以下可能性:
- 将离散时间模型转换为连续时间模型,
- 识别连续时间模型,
- 采用 LQR 方法来确定离散时域的最佳 PID 参数。
在 Matlab 中,前两种方法很容易完成,但我在 Python 中需要它们。有人知道Matlab是如何实现d2c
的并有参考吗?
解决方案
有几个选项可以使用python-control
包或scipy.signal
模块或使用harold
(无耻插件:我是作者)。
这是一个例子
import harold
G = harold.Transfer(1, [1, 2, 1])
H_zoh = harold.discretize(G, dt=0.1, method='zoh')
H_tus = harold.discretize(G, dt=0.1, method='tustin')
H_zoh.polynomials
Out[5]:
(array([[0.00467884, 0.00437708]]),
array([[ 1. , -1.80967484, 0.81873075]]))
H_tus.polynomials
Out[6]:
(array([[0.00226757, 0.00453515, 0.00226757]]),
array([[ 1. , -1.80952381, 0.8185941 ]]))
目前支持zoh
, foh
, tustin
, forward euler
,backward euler
包括非离散化。该文档位于http://harold.readthedocs.io/en/latest/index.html
推荐阅读
- java - 我可以在不同的类中覆盖方法吗?
- google-chrome - 停止浏览器从服务器请求 service-worker.js
- javascript - 如何为根节点的直接子节点制作选择器?
- powershell - 如何以指定格式将数组的值输出到文本文件
- wordpress - Wordpress 问题,更新后
- asp.net-mvc - Azure Active Directory 身份验证突然停止工作并将页面重定向到登录/注销页面。我怎样才能让它工作?
- python - 在最后两点设置小数
- javascript - javascript数组即将为空
- vb.net - 有没有一种方法可以从 vb.net 中的数组生成随机字符串而不会重复
- jenkins - 如何在 Jenkins 上制作 groovy 以与凭据相同的方式屏蔽变量的输出?