main Content

为基于帧的处理创建信号

In frame-based processing, blocks process data one frame at a time. Each frame of data contains sequential samples from an independent channel. Each channel is represented by a column of the input signal. For example, from a frame-based processing perspective, the following 3-by-2 matrix has two channels, each of which contains three samples.

当您配置一个块以执行基于帧的处理时,该块解释了m-b-1矢量作为包含单通道信号msamples per frame. Similarly, the block interprets anm-by-n矩阵作为多通道信号n独立渠道和msamples per channel. For example, in frame-based processing, blocks interpret the following sequence of 3-by-2 matrices as a two-channel signal with a frame size of 3.

使用基于帧的处理对于许多信号处理应用程序是有利的,因为您可以一次处理多个样本。通过将数据缓冲到帧中并处理数据的多样本帧,您通常可以改善信号处理算法的计算时间。要执行基于框架的处理,您必须拥有DSP System Toolbox™许可证。

有关有关基于框架的处理的最新更改的更多信息,请参见基于框架的处理更改部分DSP系统工具箱Release Notes

此页面讨论使用使用该框架处理的信号正弦波block and the来自工作区的信号堵塞。note that the block receiving this signal implements sample-based processing or frame-based processing on the signal based on the parameters set in the block dialog box.

使用正弦波块创建信号

  1. 创建一个新的simulin万博1manbetxk®模型。

  2. 从源库中,将正弦波块单击到模型中。

  3. 从矩阵操作库中,单击矩阵总块进入模型。

  4. From the Simulink Sinks library, click-and-drag a To Workspace block into the model.

  5. 连接块的顺序添加them to your model.

  6. 双击正弦波block, and set the block parameters as follows:

    • 振幅=[1 3 2]

    • 频率=[100 250 500]

    • 采样时间=1/5000

    • 每个框架样品=64

    基于这些参数,正弦波块输出了三个带有振幅的正弦曲线1,,,,3,,,,and2and frequencies100,,,,250,,,,and500Hz,分别。样本周期为1/5000,是最高正弦频率的10倍,满足奈奎斯特标准。所有正弦曲线的帧大小为64,因此,输出具有64行。

  7. 保存这些参数,然后单击关闭对话框OK

    You have now successfully created a three-channel signal, with64samples per each frame, using the正弦波堵塞。The rest of this procedure describes how to add these three sinusoids together.

  8. 双击矩阵总块。设置总结参数为指定的维度,并设置Dimension参数为2。点击OK

  9. In theDebug模型工具条的选项卡,选择信息叠加>信号尺寸

  10. 运行模型。

    您的模型现在看起来应该与下图相似。您也可以通过键入打开模型EX_USINGINWAVEBLKFB在Matlab®命令行。

    这三个信号通过矩阵总块逐点求和。然后,它们被导出到MATLAB工作区。

  11. At the MATLAB command line, typeplot(yout(1:100))

    Your plot should look similar to the following figure.

This figure represents a portion of the sum of the three sinusoids. You have now added the channels of a three-channel signal together and displayed the results in a figure window.

使用信号使用来自工作区的信号Block

基于框架的处理可以通过减少模拟运行所需的时间来显着提高模型的性能。本主题描述了如何创建一个两频道信号,其示例周期为1秒,帧周期为4秒,并使用该帧大小为4个样本。来自工作区的信号堵塞。

  1. 创建一个新的simulin万博1manbetxk模型。

  2. From the Sources library, click-and-drag a来自工作区的信号block into the model.

  3. From the Simulink Sinks library, click-and-drag a到工作区block into the model.

  4. 连接两个块。

  5. 双击来自工作区的信号块,并设置块参数如下。

    • 信号=[1:10;1 1 0 0 1 1 1 0 0 1 1]''

    • 采样时间=1

    • 每个框架样品=4

    • Form output after final data value by=设置为零

    基于这些参数,来自工作区的信号block outputs a two-channel signal with a sample period of 1 second, a frame period of 4 seconds, and a frame size of four samples. After the block outputs the signal, all subsequent outputs have a value of zero. The two channels contain the following values:

    • 频道1:1、2、3、4、5、6、7、8、9、10、0、0,...

    • 频道2:1、1、0、0、1、1、0、0、1、1、0、0、0,...

  6. 保存这些参数,然后单击关闭对话框OK

  7. In theDebug模型工具条的选项卡,选择信息叠加>信号尺寸

  8. 运行模型。

    The following figure is a graphical representation of the model's behavior during simulation. You can also open the model by typingEX_USINGSFWBLKFB在MATLAB命令行。

  9. At the MATLAB command line, type

    The following is the output displayed at the MATLAB command line.

    yout = 1 1 2 1 3 0 4 0 5 1 6 1 7 0 8 0 9 1 10 1 0 0 0 0 0

请注意,将零附加到每个通道的末尾。您现在已经成功创建了一个两通道信号,并将其导出到MATLAB工作区。

Related Topics