主要内容

Creating Continuous-Time Models

This example shows how to create continuous-time linear models using thetf,ZPK.,ss, 和FRD.commands.

LTI模型类型

控制系统工具箱™ provides functions for creating four basic representations of linear time-invariant (LTI) models:

  • 传递函数(TF)模型

  • Zero-pole-gain (ZPK) models

  • State-space (SS) models

  • Frequency response data (FRD) models

这些功能将模型数据作为输入,并在单个MATLAB®变量中创建体现该数据的对象。

创建传输函数模型

Transfer functions (TF) are frequency-domain representations of LTI systems. A SISO transfer function is a ratio of polynomials:

H ( s ) = A ( s ) B ( s ) = a 1 s n + a 2 s n - 1 + + a n + 1 b 1 s m + b 2 s m - 1 + + b m + 1

Transfer functions are specified by their numerator and denominator polynomialsA(s)B(s). In MATLAB, a polynomial is represented by the vector of its coefficients, for example, the polynomial

s 2 + 2 s + 1 0

被指定为[1 2 10].

要创建表示传输功能的TF对象:

H ( s ) = s s 2 + 2 s + 1 0

specify the numerator and denominator polynomials and usetf要构建TF对象:

num = [ 1 0 ];% Numerator: sden = [1 2 10];%分母:S ^ 2 + 2 s + 10H = TF(NUM,DEN)
h = s ------------- S ^ 2 + 2 s + 10连续时间传递函数。

Alternatively, you can specify this model as a rational expression of the Laplace variables:

s = tf('s');% Create Laplace variableH = s / (s + s ^ 2 + 2 * 10)
h = s ------------- S ^ 2 + 2 s + 10连续时间传递函数。

创建零极化模型

零极化(ZPK)模型是转移功能的因子形式:

H ( s ) = k ( s - z 1 ) ( s - z n ) ( s - p 1 ) ( s - p m )

Such models expose the rootszof the numerator (the zeros) and the rootsp分母(极点)。标量系数kis called the gain.

To create the ZPK model:

H ( s ) = - 2 s ( s - 2 ) ( s 2 - 2 s + 2 )

指定杆和零的载体和增益k:

z = 0;%零p = [2 1 + i 1-i];%极点k = -2;% 获得h = zpk(z,p,k)
H = -2 s ------------------(S-2)(S ^ 2  -  2s + 2)连续时间零/杆/增益模型。

至于TF模型,您还可以将此模型指定为合理的表达式s:

s = zpk('s');h = -2 * s /(s  -  2)/(s ^ 2  -  2 * s + 2)
H = -2 s ------------------(S-2)(S ^ 2  -  2s + 2)连续时间零/杆/增益模型。

Creating State-Space Models

状态空间(SS)模型是LTI系统的时域表示:

d x d t = A x ( t ) + B u ( t )

y ( t ) = C x ( t ) + D u ( t )

wherex(t)is the state vector,你(t)is input vector, andy(t)is the output trajectory.

状态空间模型来自描述系统动态的微分方程。例如,考虑一个简单的电动机的二阶ode:

d 2 θ. d t 2 + 2 d θ. d t + 5 θ. = 3 I

whereI是驱动电流(输入)和thetais the angular displacement of the rotor (output). This ODE can be rewritten in state-space form as:

d x d t = A x + B I A = [ 0 1 - 5 - 2 ] B = [ 0 3 ] x = [ θ. d θ. d t ]

θ. = C x + D I C = [ 1 0 ] D = [ 0 ]

To create this model, specify the state-space matricesA B C D和使用ssto construct the SS object:

a = [0 1;-5 -2];b = [0;3];c = [1 0];d = 0;h = ss(a,b,c,d)
H = A = x1 x2 x1 0 1 x2 -5 -2 B = u1 x1 0 x2 3 C = x1 x2 y1 1 0 D = u1 y1 0 Continuous-time state-space model.

创建频率响应数据模型

Frequency response data (FRD) models let you store the measured or simulated complex frequency response of a system in an LTI object. You can then use this data as a surrogate model for frequency-domain analysis and design purposes.

For example, suppose you get the following data out of a frequency analyzer:

  • Frequency (Hz): 10, 30, 50, 100, 500

  • Response: 0.0021+0.0009i, 0.0027+0.0029i, 0.0044+0.0052i, 0.0200-0.0040i, 0.0001-0.0021i

You can create an FRD object containing this data using:

freq = [10, 30, 50, 100, 500]; resp = [0.0021+0.0009i, 0.0027+0.0029i, 0.0044+0.0052i, 0.0200-0.0040i, 0.0001-0.0021i]; H = frd(resp,freq,'单位','赫兹')
H =频率(Hz)响应------------ -------- 10 2.100E-03 + 9.000E-04I 30 2.700E-03 + 2.900E-03I 50 4.400E-03 + 5.200E-03I 100 2.000E-02  -  4.000E-03I 500 1.000E-04  -  2.100E-03I连续时间频率响应。

Note that frequency values are assumed to be in rad/s unless you specify the单位to be Hertz.

Creating MIMO Models

Thetf,ZPK.,ss, 和FRD.commands let you construct both SISO and MIMO models. For TF or ZPK models, it is often convenient to construct MIMO models by concatenating simpler SISO models. For example, you can create the 2x2 MIMO transfer function:

H ( s ) = [ 1 s + 1 0 s + 1 s 2 + s + 3 - 4 s s + 2 ]

using:

s = tf('s');H = [ 1/(s+1) , 0 ; (s+1)/(s^2+s+3) , -4*s/(s+2) ]
H =从输入1输出...... 1 1:----- S + 1 S + 1 2: -   -   -   -   -   -   -   -   -   -   -   -  --------从输入2到输出的+ 3 + 3。.. 1:0 -4 S 2:----- S + 2连续时间传递函数。

分析LTI模型

控制系统工具箱provides an extensive set of functions for analyzing LTI models. These functions range from simple queries about I/O size and order to sophisticated time and frequency response analysis.

For example, you can obtain size information for the MIMO transfer functionH通过键入上面指定:

size(H)
传输功能,具有2个输出和2个输入。

You can compute the poles using:

pole(H)
ans =4×1复合物-1.0000 + 0.0000i -0.5000 + 1.6583i -0.5000 - 1.6583i -2.0000 + 0.0000i

You can ask whether this system is stable using:

isstable(H)
ans =logical1

最后,您可以通过打字绘制步骤响应:

步骤(h)

Figure contains 4 axes objects. Axes object 1 with title From: In(1) contains an object of type line. This object represents H. Axes object 2 contains an object of type line. This object represents H. Axes object 3 with title From: In(2) contains an object of type line. This object represents H. Axes object 4 contains an object of type line. This object represents H.

See Also

||||

相关话题