DSP Blockset
  Go to block:
    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.

Consider a series of matrix inputs, 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.

In both sample-based and frame-based modes, vector and scalar inputs are treated as special matrix cases. See "Scalars and Vectors" in "Understanding Matrices" earlier in this chapter. The following sections provide some examples of common sample-based and frame-based block operations. See the "DSP Block Reference" chapter for complete information about any particular block.

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:

To try the model:

   1.
Create sig1, sig2, and sig3 in the workspace by typing the following commands.
   2.
Double-click the Signal From Workspace block and enter
   3.
Double-click on the Downsample block and enter 2 for the Downsample factor parameter. Leave the Frame-based inputs parameter unchecked so that the block will operate in sample-based mode.

   4.
Set the Stop time in the Simulation Parameters dialog box to 20, and start the simulation by selecting Start from the Simulation menu.
If you look at output 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.

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:

To try the model:

   1.
Load three signals into the workspace, and rename them as shown.
   2.
Double-click on each Signal From Workspace block in turn and type in one of the signal names for the Signal parameter:
   3.
Double-click on each Time Scope block in turn and press the Properties button, ,to set the scope properties:
   4.
Double-click on the Digital FIR Filter Design block, and verify that the Frame-based inputs check box is not selected.

   5.
Set the Stop time to 2 in the Simulation Parameters dialog box (available through the Simulation menu).
   6.
Start the simulation by selecting Start from the Simulation menu.
As the simulation runs, you can see that the Digital FIR Filter Design block is filtering each of the three signals independently; there is no interaction between 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:

To try the model:

   1.
Double-click the Sine Wave block enter the following parameter values
  1. Amplitude = [1 2]
  2. Frequency = [100 25]
  3. Sample time = 0.001
  4. Samples per frame = 1
   2.
Double-click on the Sum block and enter 1 for the List of signs parameter.
   3.
Double-click on the Shift Register block and set the Register size to 256.
   4.
Double-click on the Window Function block and set the Operation parameter to Apply window to input.
   5.
Double-click on the Complex to Magnitude-Angle block and set the Output parameter to Magnitude.
   6.
Double-click on the Frequency Frame Scope block and set the Frequency units to Hertz. Set the Sample time of original time series to 0.001. Verify that the Number of input channels is set to 1, as below.

   7.
Set the Stop time in the Simulation Parameters dialog box to inf, and start the simulation by selecting Start from the Simulation menu.
The Shift Register block buffers the sinusoidal signal into a frame vector, which is then windowed by the Window Function block. The FFT block operates on the frame-based data as a single unit at each time step. Note that because the Shift Register block implements an overlapping buffer, the sample period of the original signal must be explicitly specified in the Sample time of original time series parameter of the Frequency Frame Scope block.

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:

   1.
Create sig1, sig2, and sig3 in the workspace (if you haven't already) by typing the following commands.
   2.
Double-click on the Signal From Workspace block and enter
for the Signal parameter to define the three channel signal. Then set the Samples per frame parameter to 8 to establish a frame size of 8 for each channel.

   3.
Double-click on the Signal To Workspace block and set the Number of channels parameter to 3 to match the signal.
   4.
Double-click on the Downsample block and make the following settings:
  1. Enter 2 for the Downsample factor parameter.
  2. Check the Frame-based inputs parameter so that the block will operate in frame-based mode.
  3. Set the Number of channels to 3 to match the signal.
  4. Set the Framing parameter to Maintain input frame rate. This will allow the block to downsample the signal by adjusting the frame size.

   5.
Select Vector Line Widths from the Format menu to activate the vector line width display.
   6.
Set the Stop time in the Simulation Parameters dialog box to 20, and start the simulation by selecting Start from the Simulation menu
When the simulation begins running, the model's line widths reveal that the matrix output of the Downsample block contains half the number of elements of the input (12 vs. 24), as expected for decimation by a factor of two. Check the output, yout, to verify that the block independently downsamples each channel over time:

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.



[ Previous | Help Desk | Next ]