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:
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
被指定为[1 2 10]
.
要创建表示传输功能的TF对象:
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)模型是转移功能的因子形式:
Such models expose the rootsz
of the numerator (the zeros) and the rootsp
分母(极点)。标量系数k
is called the gain.
To create the ZPK model:
指定杆和零的载体和增益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系统的时域表示:
wherex(t)
is the state vector,你(t)
is input vector, andy(t)
is the output trajectory.
状态空间模型来自描述系统动态的微分方程。例如,考虑一个简单的电动机的二阶ode:
whereI
是驱动电流(输入)和theta
is the angular displacement of the rotor (output). This ODE can be rewritten in state-space form as:
To create this model, specify the state-space matricesA B C D
和使用ss
to 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:
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)