主要内容

get

访问模型属性值

语法

Value = get(sys,'PropertyName')
Struct = get(sys)

说明

Value = get(sys,'PropertyName') 返回模型对象 sys 的属性 PropertyName 的当前值。'PropertyName' 可以是完整属性名称(例如 'UserData'),也可以是任何无歧义的不区分大小写的缩写(例如 'user')。有关该模型可用的属性列表,请参阅各模型对象类型的参考页。

Struct = get(sys) 将 TF、SS 或 ZPK 对象 sys 转换为标准 MATLAB® 结构体,其中属性名称作为字段名称,属性值作为字段值。

不带左侧参量时,

get(sys)

显示 sys 的所有属性及其值。

示例

全部折叠

创建以下离散时间 SISO 传递函数模型:

H(z)=1z+2

指定采样时间为 0.1 秒,输入通道名称为 Voltage

h = tf(1,[1 2],0.1,'InputName','Voltage')
h =
 
  From input "Voltage" to output:
    1
  -----
  z + 2
 
Sample time: 0.1 seconds
Discrete-time transfer function.
Model Properties

显示该传递函数的所有属性。

get(h)
       Numerator: {[0 1]}
     Denominator: {[1 2]}
        Variable: 'z'
         IODelay: 0
      InputDelay: 0
     OutputDelay: 0
       InputName: {'Voltage'}
       InputUnit: {''}
      InputGroup: [1×1 struct]
      OutputName: {''}
      OutputUnit: {''}
     OutputGroup: [1×1 struct]
           Notes: [0×1 string]
        UserData: []
            Name: ''
              Ts: 0.1000
        TimeUnit: 'seconds'
    SamplingGrid: [1×1 struct]

显示该传递函数的分子。

num = get(h,'Numerator')
num = 1×1 cell array
    {[0 1]}

分子数据以元胞数组形式存储,因此 Numerator 属性是包含行向量 [0 1] 的元胞数组。

num{1}
ans = 1×2

     0     1

显示该传递函数的采样时间 Ts

get(h,'Ts')
ans = 
0.1000

或者,使用圆点表示法访问属性值。

h.Ts
ans = 
0.1000

提示

语法的替代方法

Value = get(sys,'PropertyName')

是类结构体引用

Value = sys.PropertyName

例如,

sys.Ts
sys.A
sys.user

返回(状态空间)模型 sys 的采样时间、A 矩阵和 UserData 属性的值。

版本历史记录

在 R2006a 之前推出

另请参阅

| | | | | (System Identification Toolbox) | (System Identification Toolbox)