2

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

我对stepinfo. 它似乎返回一个结构。所以我将上述结果分配给一个变量并使用size(). 这是一个 1x1 矩阵。

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

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

4

1 回答 1

4

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

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

有关使用结构的更多信息,请查看此文档页面

于 2011-02-21T17:53:27.787 回答