主要内容

在时间域和频域数据之间转换

系统标识工具箱™ provides tools for analyzing data and for estimating and evaluating models in both the time and the frequency domains. To use tools and methods that are not in the same domain as your measured data, you can transform your data between the time domain and the frequency domain.

Theiddataobject stores time-domain or frequency-domain data.

  • Time-domaindata consists of one or more input variablesu(t)和一个或多个输出变量y(t), sampled as a function of time.

  • Frequency-domaindata consists of either transformed input and output time-domain signals or system frequency response sampled as a function of the independent variable frequency.

For detailed information about representing time-domain and frequency-domain data in MATLAB®, seeRepresenting Data in MATLAB Workspace.

您可以将数据从一个域转换为另一个域。该表总结了时间和频域之间转换数据的命令。有关更多命令信息,请参见相应的命令参考页面。

Command Description Syntax Example
FFT

Transform time-domain data to the frequency domain.

You can specifyN,频率值的数量。

To transform time-domainiddataobjectT_DATAto frequency-domainiddataobjectf_datawithNfrequency points, use:

f_data = fft(t_data,N)
ifft Transform frequency-domain data to the time domain. Frequencies are linear and equally spaced.

To transform frequency-domainiddataobjectf_datato time-domainiddataobjectT_DATA使用:

T_DATA= ifft(f_data)

转换iddata将数据数据形式IDFRDfrequency response is a type of estimation. If you want to estimate the frequency response using aniddataobject, seeTransforming Between Frequency-Domain and Frequency-Response Data.

Transform Data Between Time and Frequency Domains

将数据从时间域转换为频域,然后回到时域,并比较根据原始数据和转换数据估计的模型的性能。

加载和绘制时间域数据z1, which contains 300 samples.

loadiddata1z1plot(z1)

图包含2个轴。Axes 1 with title y1 contains an object of type line. This object represents z1. Axes 2 with title u1 contains an object of type line. This object represents z1.

Find the sample timeTsz1.

TS = Z1.TS
TS = 0.1000

The sample time is 0.1 s.

Transformz1into the frequency domain.

z1f = fft(z1)
Z1F =频域数据集,响应在151个频率下。频率范围:0至31.416 RAD/秒样本时间:0.1秒输出单元(如果指定)Y1输入单元(如果指定)U1

The frequency range extends to 31.416 rad/s, which is equal to the Nyquist frequency ofpi/Ts.

绘制频域数据。

plot(z1f)

Figure contains 4 axes. Axes 1 with title y1 contains an object of type line. This object represents z1f. Axes 2 contains an object of type line. This object represents z1f. Axes 3 with title u1 contains an object of type line. This object represents z1f. Axes 4 contains an object of type line. This object represents z1f.

Transformz1f返回时域并将两个时间域信号绘制在一起。

Z1T = IFFT(Z1F)
z1t = Time domain data set with 300 samples. Sample time: 0.1 seconds Outputs Unit (if specified) y1 Inputs Unit (if specified) u1
plot(z1t,z1)

图包含2个轴。带标题Y1的轴1包含2个类型行的对象。这些对象代表Z1T,Z1。带标题U1的轴2包含2个类型行的对象。这些对象代表Z1T,Z1。

The signals line up precisely.

Estimate second-order state-space models forz1z1t.

sys1 = sest(z1,2);sys1t = sest(z1t,2);比较(z1,sys1,sys1t)

图包含一个轴。轴包含3个类型线的对象。这些对象代表Z1(Y1),SYS1:70.63%,SYS1T:70.63%。

Estimate a state-space model forz1f.

sys1f = ssest(z1f,2); compare(z1f,sys1f)

图包含2个轴。轴1包含2个类型线的对象。这些对象代表Z1F(Y1),SYS1F:70.85%。轴2包含2个类型线的对象。这些对象代表Z1F(Y1),SYS1F:70.85%。

The fit percentages for the time-domain and frequency-domain models are similar.

See Also

|||||

相关话题