Contents

Deconstruct Multichannel Sample-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.

You can split a multichannel sample-based signal into single-channel sample-based signals using the Multiport Selector block. This block allows you to select specific rows and/or columns and propagate the selection to a chosen output port. In this example, a three-channel sample-based signal is deconstructed into three independent sample-based signals:

  1. Open the Multiport Selector Example 1 model by typing ex_splitmltichsbsigsindex_splitmltichsbsigsind at the MATLAB® command line.

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

    • Signal = randn(3,1,10)

    • Sample time = 1

    • Samples per frame = 1

    Based on these parameters, the Signal From Workspace block outputs a three-channel, sample-based signal with a sample period of 1 second.

  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 = Rows

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

    Based on these parameters, the Multiport Selector block extracts the rows of the input. The Indices to output parameter setting specifies that row 1 of the input should be reproduced at output 1, row 2 of the input should be reproduced at output 2, and row 3 of the input should be reproduced at output 3.

  5. Run the model.

  6. At the MATLAB command line, type dsp_examples_yout.

    The following is a portion of what is displayed at the MATLAB command line. Because the input signal is random, your output might be different than the output show here.

    dsp_examples_yout(:,:,1) =
    
       -0.1199
    
    dsp_examples_yout(:,:,2) =
    
       -0.5955
    
    dsp_examples_yout(:,:,3) =
    
       -0.0793

    This sample-based signal is the first row of the input to the Multiport Selector block. You can view the other two input rows by typing dsp_examples_yout1 and dsp_examples_yout2, respectively.

You have now successfully created three, single-channel sample-based signals from a multichannel sample-based signal using a Multiport Selector block.

Split Multichannel Signals into Several Multichannel 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.

You can split a multichannel sample-based signal into other multichannel sample-based signals using the Submatrix block. The Submatrix block is the most versatile of the blocks in the Indexing library because it allows arbitrary channel selections. Therefore, you can extract a portion of a multichannel sample-based signal. In this example, you extract a six-channel, sample-based signal from a 35-channel, sample-based signal (5-by-7 matrix):

  1. Open the Submatrix Example model by typing ex_splitmltichsbsigsevex_splitmltichsbsigsev at the MATLAB command line.

  2. Double-click the Constant block, and set the block parameters as follows:

    • Constant value = rand(5,7)

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

    • Sampling mode = Sample based

    • Sample Time = 1

    Based on these parameters, the Constant block outputs a constant-valued, sample-based signal.

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

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

    • Row span = Range of rows

    • Starting row = Index

    • Starting row index = 3

    • Ending row = Last

    • Column span = Range of columns

    • Starting column = Offset from last

    • Starting column offset = 1

    • Ending column = Last

    Based on these parameters, the Submatrix block outputs rows three to five, the last row of the input signal. It also outputs the second to last column and the last column of the input signal.

  5. Run the model.

    The model should now look similar to the following figure.

    Notice that the output of the Submatrix block is equivalent to the matrix created by rows three through five and columns six through seven of the input matrix.

You have now successfully created a six-channel, sample-based signal from a 35-channel sample-based signal using a Submatrix block.

Was this topic helpful?