主要内容

是使用正确的模型tion

This example shows some best practices for working with LTI models.

Which Representation is Best Suited for Computations?

Using the Control System Toolbox™ software, you can represent LTI systems in four different ways:

  • Transfer function (TF)

  • 零极生(ZPK)

  • State space (SS)

  • 频率响应数据(FRD)

While the TF and ZPK representations are compact and convenient for display purposes, they are not ideal for system manipulation and analysis for several reasons:

  • Working with TF and ZPK models often results in high-order polynomials whose evaluation can be plagued by inaccuracies.

  • The TF and ZPK representations are inefficient for manipulating MIMO systems and tend to inflate the model order.

Some of these limitations are illustrated below. Because of these limitations, you should use the SS or FRD representations for most computations involving LTI models.

Pitfalls of High-Order Transfer Functions

涉及高级传递功能的计算可能会严重丧失准确性甚至溢出。如下所示,即使是两个传输功能的简单产品也可以给出令人惊讶的结果。

加载和绘制两个离散时间传输功能PdCdof order 9 and 2, respectively:

% Load Pd,Cd modelsloadnumdemoPdCd% Plot their frequency responseBode(PD,'b',Cd,'r'),网格传奇('Pd','Cd')

Next, compute the open-loop transfer function L = Pd*Cd using the TF, ZPK, SS, and FRD representations:

Ltf = Pd * Cd;% TFlzp = zpk(pd) * cd;% ZPKLss = ss(Pd) * Cd;% SSw = logspace(-1,3,100); Lfrd = frd(Pd,w) * Cd;% FRD

最后,比较由此产生的四个模型的频率响应幅度:

Sigma(LTF,'B--',Lzp,'g',Lss,'R:',Lfrd,'M--',{1e-1,1e3}); legend('TF','ZPK','SS','FRD')

来自ZPK,SS和FRD表示的响应密切匹配,但是TF表示的响应断断续续且低于100 rad/sec。要了解传递函数表格的准确性丧失,请比较Z = 1的PD和CD的极/零图:

PZPLOT(PD,'b',Cd,'r');标题('Pole/zero maps of Pd (blue) and Cd (red)');axis([0.4 1.05 -1 1])

Note that there are multiple roots near z=1. Because the relative accuracy of polynomial values drops near roots, the relative error on the transfer function value near z=1 exceeds 100%. The frequencies below 100 rad/s map to| Z-1| <1e-3,解释了低于100 rad/s的不稳定结果。

Pitfalls of Back-and-Forth Conversions Between Representations

You can easily convert any LTI model to transfer function, zero-pole-gain, or state-space form using the commandstf,ZPK, 和ss, respectively. For example, given a two-input, two-output random state-space model HSS1 created using

HSS1 = rss(3,2,2);

您可以使用

HTF = tf(HSS1);

并使用

HSS2 = ss(HTF);

但是,请注意,这种来回转换很昂贵,可能会损失准确性,并为MIMO系统的模型顺序膨胀。例如,HSS2is double that ofHSS1because 6 is the generic order of a 2x2 transfer matrix with denominators of degree 3:

order(HSS1)
ans = 3
订单(HSS2)
ans = 6

要了解模型顺序的差异,请比较两个模型的极/零图:

subplot(211) pzmap(HSS1,'b') 标题('Poles and zeros of HSS1');subplot(212) pzmap(HSS2,'r') 标题('Poles and zeros of HSS2');

Notice the cancelling pole/zero pairs in HSS2 depicted by x's inside o's in the pole/zero map. You can use the command微小to eliminate cancelling pole/zero pairs and recover a 3rd-order, minimal state-space model from HSS2:

hss2_min= minreal(HSS2);
3 states removed.
order(HSS2_min)
ans = 3

检查一下HSS1hss2_mincoincide by plotting the relative gap between these two models:

clf Gap = HSS1-HSS2_min; sigma(HSS1,Gap), grid
警告:频率响应的相对精度较差。这可能是因为在所有频率下的响应几乎为零或无限,或者是因为状态空间实现的条件不佳。使用“预定”命令进一步调查。
legend('HSS1','Gap HSS1 vs. minimal HSS2','地点','Best')

The gap (green curve) is very small at all frequencies. Note thatsigmawarns that theGapplot is "noisy" because the difference is so small that it essentially consists of rounding errors.

Because extracting minimal realizations is numerically tricky, you should avoid creating nonminimal models. See also防止系统互连中的状态重复for related insights.