Contents

Deconstruct Multichannel Frame-Based Signals

    Note:   Starting in R2010b, many DSP System Toolbox™ blocks received a new parameter to control whether they perform sample- or frame-based processing. The following content has not been updated to reflect this change. For more information, see the Frame-Based Processing section of the 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 frame-based signal. These signals form single-channel frame-based signals that have the same frame rate and 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 and a two channel frame-based signal from a multichannel frame-based signal:

  1. Open the Multiport Selector Example 2 model by typing ex_splitmltichfbsigsindex_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, frame-based 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 frame-based signal into a single-channel signal and a two-channel signal.

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

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

Reorder Channels in Multichannel Frame-Based 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-based 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 frame-based signals. This example explains how to accomplish this task:

  1. Open the Permute Matrix Example model by typing ex_reordermltichfbsigsex_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, frame-based 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

    • Sampling mode = Frame based

    • Frame period = 4

    The discrete-time, frame-based 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 frame-based 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-based signal using the Permute Matrix block.

Was this topic helpful?