zoukankan      html  css  js  c++  java
  • matlab Time-domain analysis 渐进式或者实时获取仿真值

    首先准备一个传递函数sys,

    然后使用lsim(sys,u,t,x0)函数(通用的时序分析的函数)

    u: The input u is an array having as many rows as time samples (length(t)) and as many columns as system inputs.

    x0:further specifies an initial condition x0 for the system states. This syntax applies only when sys is a state-space model. x0 is a vector whose entries are the initial values of the corresponding states of sys.

    迭代使用的关键是使用上一步的结果,对x0进行赋值

    具体实现:使用python环境,使用 control库。

    关键代码片段如下:

    1    #u是前文设置的系统输入,t是时序
    2 lastValue=0
    3 result=[]
    4 for i in range(len(t) - 1):
    5     y= lsim(T1, U=u[i:i + 2], T=t[i:i + 2], X0=lastValue)
    6     lastValue = y[2][1]
    7     result.append(y[0][0])

    注意,y是三个数组的元组形式 y=(yout, T ,xout) 。X0传递的是xout。

  • 相关阅读:
    梯度下降法
    超平面
    感知机模型
    三角不等式
    统计学习方法基本概念
    Kaggle 的注册和使用
    win10 部署 Anaconda
    全概率和贝叶斯公式
    行列式
    伴随矩阵
  • 原文地址:https://www.cnblogs.com/xunhanliu/p/10621332.html
Copyright © 2011-2022 走看看