【问题标题】:How can I extract data members from stepinfo output in MATLAB?如何从 MATLAB 中的 stepinfo 输出中提取数据成员?
【发布时间】:2011-02-21 17:51:09
【问题描述】:

stepinfo 函数在传递函数(即stepinfo(tf))上运行时,典型结果是:

    RiseTime: 52.2052
SettlingTime: 85.4916
 SettlingMin: 0.9041
 SettlingMax: 1.0012
   Overshoot: 0.1192
  Undershoot: 0
        Peak: 1.0012
    PeakTime: 132.8773

我对@9​​87654324@ 做了一些研究。它似乎返回一个结构。所以我将上述结果分配给一个变量并使用size() 检查它的大小。 这是一个 1x1 矩阵。

这让我非常确信,如果不先将其分配给字符串然后执行字符串操作,我就无法从该结构中提取单个数据成员。

我需要 Overshoot 和 PeakTime 值,有谁知道在不使用 P.O. 的情况下获取这些值的最佳方法。和 Tp 公式 - 并且没有巨大的字符串混乱?

【问题讨论】:

    标签: matlab matlab-struct


    【解决方案1】:

    MATLAB 中的所有内容都被视为矩阵。单个结构元素(在您的示例中由 stepinfo 返回)是 struct 类型的 1×1 矩阵。您可以像这样访问结构的字段:

    S = stepinfo(sys);        %# Returns a structure, stored in variable S
    overShoot = S.Overshoot;  %# Get the value in the Overshoot field
    peakTime = S.PeakTime;    %# Get the value in the PeakTime field
    

    有关使用结构的更多信息,请查看this documentation page

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 2018-05-23
      • 2011-02-27
      • 2013-06-18
      • 2023-01-31
      相关资源
      最近更新 更多