Accelerating the pace of engineering and science

Documentation

Create Multichannel Sample-Based Signals

Multichannel Sample-Based Signals

When you want to perform the same operations on several independent signals, you can group those signals together as a multichannel signal. For example, if you need to filter each of four independent signals using the same direct-form II transpose filter, you can combine the signals into a multichannel signal, and connect the signal to a single Digital Filter Design block. The block applies the filter to each channel independently.

A sample-based signal with M*N channels is represented by a sequence of M-by-N matrices. Multiple sample-based signals can be combined into a single multichannel sample-based signal using the Concatenate block. In addition, several multichannel sample-based signals can be combined into a single multichannel sample-based signal using the same technique.

Create Multichannel Signals by Combining Single-Channel Signals

You can combine individual sample-based signals into a multichannel signal by using the Matrix Concatenate block in the Simulink® Math Operations library:

1. Open the Matrix Concatenate Example 1 model by typing

`ex_cmbsnglchsbsigs ex_cmbsnglchsbsigs `

at the MATLAB® command line.

2. Double-click the Signal From Workspace block, and set the Signal parameter to 1:10. Click OK.

3. Double-click the Signal From Workspace1 block, and set the Signal parameter to -1:-1:-10. Click OK.

4. Double-click the Signal From Workspace2 block, and set the Signal parameter to zeros(10,1). Click OK.

5. Double-click the Signal From Workspace3 block, and set the Signal parameter to 5*ones(10,1). Click OK.

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

• Number of inputs = 4

• Mode = Multidimensional array

• Concatenate dimension = 1

7. Double-click the Reshape block. Set the block parameters as follows, and then click OK:

• Output dimensionality = Customize

• Output dimensions = [2,2]

8. Run the model.

Four independent sample-based signals are combined into a 2-by-2 multichannel matrix signal.

Each 4-by-1 output from the Matrix Concatenate block contains one sample from each of the four input signals at the same instant in time. The Reshape block rearranges the samples into a 2-by-2 matrix. Each element of this matrix is a separate channel.

Note that the Reshape block works columnwise, so that a column vector input is reshaped as shown below.

The 4-by-1 matrix output by the Matrix Concatenate block and the 2-by-2 matrix output by the Reshape block in the above model represent the same four-channel sample-based signal. In some cases, one representation of the signal may be more useful than the other.

9. At the MATLAB command line, type dsp_examples_yout.

The four-channel, sample-based signal is displayed as a series of matrices in the MATLAB Command Window. Note that the last matrix contains only zeros. This is because every Signal From Workspace block in this model has its Form output after final data value by parameter set to Setting to Zero.

Create Multichannel Signals by Combining Multichannel Signals

You can combine existing multichannel sample-based signals into larger multichannel signals using the Simulink Matrix Concatenate block:

1. Open the Matrix Concatenate Example 2 model by typing

```ex_cmbmltichsbsigsex_cmbmltichsbsigs
```

at the MATLAB command line.

2. Double-click the Signal From Workspace block, and set the Signal parameter to [1:10;-1:-1:-10]'. Click OK.

3. Double-click the Signal From Workspace1 block, and set the Signal parameter to [zeros(10,1) 5*ones(10,1)]. Click OK.

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

• Number of inputs = 2

• Mode = Multidimensional array

• Concatenate dimension = 1

5. Run the model.

The model combines both two-channel sample-based signals into a four-channel signal.

Each 2-by-2 output from the Matrix Concatenate block contains both samples from each of the two input signals at the same instant in time. Each element of this matrix is a separate channel.