This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Deconstruct Multichannel Signals for Frame-Based Processing

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.

When you configure a block to perform frame-based processing, the block interprets an M-by-1 vector as a single-channel signal containing M samples per frame. Similarly, the block interprets an M-by-N matrix as a multichannel signal with N independent channels and M samples 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.

Using frame-based processing is advantageous for many signal processing applications because you can process multiple samples at once. By buffering your data into frames and processing multisample frames of data, you can often improve the computational time of your signal processing algorithms. To perform frame-based processing, you must have a DSP System Toolbox™ license.

For more information about the recent changes to frame-based processing, see the Frame-based processing changes section of the DSP System Toolbox Release Notes.

Split Multichannel Signals into Individual Signals

Multichannel signals, represented by matrices in the Simulink® environment, are frequently used in signal processing models for efficiency and compactness. Though most of the signal processing blocks can process multichannel signals, you may need to access just one channel or a particular range of samples in a multichannel signal. You can access individual channels of the multichannel signal by using the blocks in the Indexing library. This library includes the Selector, Submatrix, Variable Selector, Multiport Selector, and Submatrix blocks. It is also possible to use the Permute Matrix block, in the Matrix operations library, to reorder the channels of a frame-based signal.

You can use the Multiport Selector block in the Indexing library to extract the individual channels of a multichannel signal. These signals form single-channel signals that have the same frame rate and frame size of the multichannel signal.

The figure below is a graphical representation of this process.

In this example, you use the Multiport Selector block to extract a single-channel signal and a two channel signal from a multichannel signal. Each channel contains four samples.

  1. Open the Multiport Selector Example 2 model by typing ex_splitmltichfbsigsind

    at the MATLAB® command line.

  2. Double-click the Signal From Workspace block, and set the block parameters as follows:

    • Signal = [1:10;-1:-1:-10;5*ones(1,10)]'

    • Samples per frame = 4

    Based on these parameters, the Signal From Workspace block outputs a three-channel signal with a frame size of four.

  3. Save these parameters and close the dialog box by clicking OK.

  4. Double-click the Multiport Selector block. Set the block parameters as follows, and then click OK:

    • Select = Columns

    • Indices to output = {[1 3],2}

    Based on these parameters, the Multiport Selector block outputs the first and third columns at the first output port and the second column at the second output port of the block. Setting the Select parameter to Columns ensures that the block preserves the frame rate and frame size of the input.

  5. Run the model.

    The figure below is a graphical representation of how the Multiport Selector block splits one frame of the three-channel signal into a single-channel signal and a two-channel signal.

The Multiport Selector block outputs a two-channel signal, comprised of the first and third column of the input signal, at the first port. It outputs a single-channel comprised of the second column of the input signal, at the second port.

You have now successfully created a single-channel signal and a two-channel signal from a multichannel signal using the Multiport Selector block.

Reorder Channels in Multichannel Signals

Multichannel signals, represented by matrices in Simulink, are frequently used in signal processing models for efficiency and compactness. Though most of the signal processing blocks can process multichannel signals, you may need to access just one channel or a particular range of samples in a multichannel signal. You can access individual channels of the multichannel signal by using the blocks in the Indexing library. This library includes the Selector, Submatrix, Variable Selector, Multiport Selector, and Submatrix blocks. It is also possible to use the Permute Matrix block, in the Matrix operations library, to reorder the channels of a frame signal.

Some DSP System Toolbox blocks have the ability to process the interaction of channels. Typically, DSP System Toolbox blocks compare channel one of signal A to channel one of signal B. However, you might want to correlate channel one of signal A with channel three of signal B. In this case, in order to compare the correct signals, you need to use the Permute Matrix block to rearrange the channels of your signals. This example explains how to accomplish this task.

  1. Open the Permute Matrix Example model by typing ex_reordermltichfbsigs at the MATLAB command line.

  2. Double-click the Signal From Workspace block, and set the block parameters as follows:

    • Signal = [1:10;-1:-1:-10;5*ones(1,10)]'

    • Sample time = 1

    • Samples per frame = 4

    Based on these parameters, the Signal From Workspace block outputs a three-channel signal with a sample period of 1 second and a frame size of 4. The frame period of this block is 4 seconds.

  3. Save these parameters and close the dialog box by clicking OK.

  4. Double-click the Constant block. Set the block parameters as follows, and then click OK:

    • Constant value = [1 3 2]

    • Interpret vector parameters as 1–D = Clear this check box

    • Sample time = 4

    The discrete-time vector output by the Constant block tells the Permute Matrix block to swap the second and third columns of the input signal. Note that the frame period of the Constant block must match the frame period of the Signal From Workspace block.

  5. Double-click the Permute Matrix block. Set the block parameters as follows, and then click OK:

    • Permute = Columns

    • Index mode = One-based

    Based on these parameters, the Permute Matrix block rearranges the columns of the input signal, and the index of the first column is now one.

  6. Run the model.

    The figure below is a graphical representation of what happens to the first input frame during simulation.

    The second and third channel of the input signal are swapped.

  7. At the MATLAB command line, type yout.

    You can now verify that the second and third columns of the input signal are rearranged.

You have now successfully reordered the channels of a frame signal using the Permute Matrix block.

Related Topics