| DSP Blockset | Search  Help Desk |
Understanding Multichannel Signal Processing
Most signal-oriented blocks in the DSP Blockset are capable of processing both sample matrices and frame matrices.u1, u2, u3, each of size 3-by-3.

A matrix-oriented block like Direct-Form II Transpose Filter can interpret this input sequence in two different ways, depending on the setting of the Frame-based inputs check box.

When the Frame-Based Inputs option is not selected, the block views the matrix as a sample matrix, treating the elements of each matrix input as concurrent samples from nine different signals; so, for example, u1(1,1) and u1(2,3) are samples from two distinct signals that correspond to the same moment in time.
When the Frame-based inputs option is selected, the block views the matrix as a frame matrix, treating each column as a frame of consecutive samples from a distinct channel (sampled over the same time period). The Number of channels parameter indicates the number of columns in the matrix.
Example 1: Sample-Based Operation with Vector Input
The Downsample block can process both sample-based and frame-based signals. To see how sample-based processing works, build the model below using:

.sig1, sig2, and sig3 in the workspace by typing the following
commands.
sig1 = (1:1000)'; sig2 = zeros(1000,1); sig3 = (-1:-1:-1000)';
.[sig1 sig2 sig3]
in the Signal parameter. This creates a length-3 sample vector, representing three signal channels. The Samples per frame parameter should remain set to 1.
.2 for the Downsample
factor parameter. Leave the Frame-based inputs parameter unchecked so
that the block will operate in sample-based mode.

.20, and start
the simulation by selecting Start from the Simulation menu.
yout in the command window, you can see that the block treats each element of the input vector as a separate channel, and downsamples the signal in each channel over time.
yout =
0 0 0
1 0 -1
3 0 -3
5 0 -5
7 0 -7
9 0 -9
11 0 -11
13 0 -13
15 0 -15
17 0 -17
19 0 -19
Each downsampled output signal is half the length of the corresponding input signal, and there is no interaction between the three channels (i.e., between the three elements in each input vector).
Example 2: Sample-Based Operation with Vector Input
Let's look at how the Digital FIR Filter Design block processes a vector input in sample-based mode. Build the model shown below using:

.load mtlb; sig_mtlb = mtlb; load chirp; sig_chirp = y; load train; sig_train = y;
.sig_mtlb
sig_chirp
sig_train
Enter 1/Fs for the Sample time parameter of each Signal From Workspace block. (Fs is the original sample frequency of the chirp and train signals, and equals 8192 Hz. It is also fairly close to the original sample frequency of the mtlb signal, which is 7418 Hz. For convenience, Fs is used for all three signals in this example.)
When the three signals are multiplexed together (using the Simulink Mux block), the result is a 3-element vector, or 3-by-1 matrix.
.
,to set the scope properties:
2.
Close the Properties windows by pressing OK, but leave the scope window open.
.

.2 in the Simulation Parameters dialog box (available
through the Simulation menu).
.sig_mtlb, sig_chirp, and sig_train (i.e., between the three elements in each input vector).

The operation is equivalent to independently filtering the three signals by using three distinct blocks, as shown below.

Note
What happens if you check Frame-based inputs in the Digital FIR Filter Design block dialog box, and set the Number of channels parameter to 3 (the number of signals)? The result is the same as filtering the three signals independently. As a general rule, frame-based processing is identical to sample-based processing when the Number of channels parameter is equal to the number of individual elements in the input.
Example 3: Frame-Based Operation with Vector Input
The FFT block is another good example of a frame-based block. To see how this block processes a frame vector input, build the model below using:

..1 for the List of signs parameter.
.256.
...0.001. Verify
that the Number of input channels is set to 1, as below.
.inf, and
start the simulation by selecting Start from the Simulation menu.
Example 4: Frame-Based Operation with Matrix Input
Use the model from Example 1 to test the Downsample block with a multichannel input in frame-based mode.
If you have already built the previous example's model, skip to step 2 below:
.sig1, sig2, and sig3 in the workspace (if you haven't already) by
typing the following commands.
sig1 = (1:1000)'; sig2 = zeros(1000,1)'; sig3 = (-1:-1:-1000)';
.[sig1 sig2 sig3]
8 to establish a frame size of 8 for each
channel.
.3 to match the signal.
.2 for the Downsample factor parameter.
3 to match the signal.

See "Rate Conversion" earlier in this chapter for more information about these parameters.
..20, and start
the simulation by selecting Start from the Simulation menu
yout, to verify that the block independently downsamples each channel over time:
yout =
0 0 0
0 0 0
0 0 0
0 0 0
1 0 -1
3 0 -3
5 0 -5
7 0 -7
9 0 -9
11 0 -11
13 0 -13
15 0 -15
After the first few samples of delay, you can see that each channel is downsampled by a factor of two; every other sample has been removed. The four-sample delay (zeros) at the start of the sequence reflects the latency inherent in frame-based models. See "Benefits of Frame-Based Processing" for more information.