| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Signal Processing Blockset |
| Contents | Index |
| Learn more about Signal Processing Blockset |
Signal Operations
dspsigops
The Downsample block decreases the sampling rate of the input by deleting samples. When the input is a frame-based Mi-by-N matrix, the block resamples each channel of the input independently. When the input is a sample-based N-D array, the Downsample block resamples the input array across time. The resample rate is K times lower than the input sample rate, where K is an integer specified by the Downsample factor parameter. The Downsample block resamples the input by discarding K–1 consecutive samples following each sample that is passed through to the output.
The Sample offset parameter delays the output samples by an integer number of sample periods, D, where 0 ≤ D < (K–1), so that any of the K possible output phases can be selected. For example, when you downsample the sequence 1, 2, 3, ... by a factor of 4, you can select from the following four phases.
| Input Sequence | Sample Offset, D | Output Sequence (K=4) |
|---|---|---|
0 | ||
1 | ||
2 | ||
3 |
The initial zero in each of the latter three output sequences in the table is a result of the default zero Initial condition parameter setting for this example. See Latency for more information on the Initial condition parameter.
This block supports triggered subsystems if, for Sample-based mode, you select Force single-rate and, for Frame-based mode, you select Maintain input frame rate.
When the input is a sample-based N-D array, the Downsample block resamples the input across time. The block downsamples the input array by discarding K–1 samples following each sample that it passes through to the output. The input and output sizes of the Downsample block are identical.
The Sample-based mode parameter determines how the block represents the new rate at the output. There are two available options:
Allow multirate
When you select Allow multirate, the sample period of the sample-based output is K times longer than the input sample period (Tso = KTsi). The block is therefore multirate.
Force single rate
When you select Force single rate, the block forces the output sample rate to match the input sample rate (Tso = Tsi) by repeating every Kth input sample K times at the output. The block is therefore single rate. (The block's operation when you select Force single rate is similar to the operation of a Sample and Hold block with a repeating trigger event of period KTsi.)
The setting of the Frame-based mode parameter does not affect sample-based inputs.
When the input is frame based, the block treats each of the N input columns as a frame containing Mi sequential time samples from an independent channel. The block downsamples each channel independently by discarding K–1 rows of the input matrix following each row that it passes through to the output.
The Frame-based mode parameter determines how the block adjusts the rate at the output to accommodate the reduced number of samples. There are two available options:
Maintain input frame size
The block generates the output at the slower (downsampled) rate by using a proportionally longer frame period at the output port than at the input port. For downsampling by a factor of K, the output frame period is K times longer than the input frame period (Tfo = KTfi), but the input and output frame sizes are equal.
The following model shows a single-channel input with a frame period of 1 second being downsampled by a factor of 4 to a frame period of 4 seconds. The input and output frame sizes are identical.

Maintain input frame rate
The block generates the output at the slower (downsampled) rate using a proportionally smaller frame size than the input. For downsampling by a factor of K, the output frame size is K times smaller than the input frame size (Mo = Mi/K), but the input and output frame rates are equal.
The following model shows a single-channel input of frame size 64 being downsampled by a factor of 4 to a frame size of 16. The input and output frame rates are identical.

The setting of the Sample-based mode pop-up menu does not affect frame-based inputs.
The Downsample block has zero-tasking latency in the following cases:
The Downsample factor parameter, K, is 1
The block input is a frame-based signal, and the Maintain input frame rate parameter is selected
The block input is a sample-based signal, and Sample offset parameter, D, is 0
Zero-tasking latency means that the block propagates input sample D+1 (received at t=0) as the first output sample, followed by input sample D+1+K, input sample D+1+2K, and so on. The Initial condition parameter value is not used.
In all other cases, the latency is nonzero:
For sample-based input, the latency is one sample.
For frame-based input, the latency is one frame.
In all cases of one-sample latency, the initial condition for each channel appears as the first output sample. Input sample D+1 appears as the second output sample for each channel, followed by input sample D+1+K, input sample D+1+2K, and so on. The Initial condition parameter can be an array of the same size as the input, or a scalar to be applied to all signal channels.
In all cases of one-frame latency, the Mi rows of the initial condition matrix appear in sequence as the first Mi output rows. Input sample D+1 (i.e, row D+1 of the input matrix) appears in the output as sample Mi+1, followed by input sample D+1+K, input sample D+1+2K, and so on. The Initial condition value can be an Mi-by-N matrix containing one value for each channel, or a scalar to be repeated across all elements of the Mi-by-N matrix. See the following example for an illustration of this case.
Note For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Scheduling Considerations in the Real-Time Workshop User's Guide. |
Construct this frame-based model.

Adjust the block parameters as follows:
Configure the Signal From Workspace block to generate a two-channel signal with frame size of 4 and sample period of 0.25 second. This represents an output frame period of 1 second (0.25*4). The first channel should contain the positive ramp signal 1, 2, ..., 100, and the second channel should contain the negative ramp signal –1, –2, ..., –100. The settings are:
Signal = [(1:100)' (-1:-1:-100)']
Sample time = 0.25
Samples per frame = 4
Configure the Downsample block to downsample the two-channel input by decreasing the output frame rate by a factor of 2 relative to the input frame rate. Set a sample offset of 1, and a 4-by-2 initial condition matrix of

Downsample factor = 2
Sample offset = 1
Initial condition = [11 -11;12 -12;13 -13;14 -14]
Frame-based mode = Maintain input frame size
Configure the Probe blocks by selecting only the Probe sample time check box.
This model is multirate because there are at least two distinct frame rates, as shown by the two Probe blocks. To run this model in the Simulink multitasking mode, open the Configuration Parameters dialog box. From the list on the left side of the dialog box, click Solver. From the Type list, select Fixed-step, and from the Solver list, select Discrete (no continuous states). From the Tasking mode for periodic sample times list, select MultiTasking. Additionally, set the Stop time parameter to 30.
Run the model and look at the output, yout. The first few samples of each channel are shown:
yout =
11 -11
12 -12
13 -13
14 -14
2 -2
4 -4
6 -6
8 -8
10 -10
12 -12
14 -14
Since you ran this frame-based multirate model in multitasking mode, the first row of the initial condition matrix appears as the first output sample, followed by the other three initial condition rows. The second row of the first input matrix (row D+1, where D is the Sample offset) appears in the output as sample 5 (sample Mi+1, where Mi is the input frame size).

The integer factor, K, by which to decrease the input sample rate.
The sample offset, D, which must be an integer in the range [0, K–1].
The value with which the block is initialized for cases of nonzero latency; a scalar value or an array of the same size as the input.
The method by which to implement downsampling for sample-based inputs: Allow multirate (decrease the output sample rate), or Force single-rate (force the output sample rate to match the input sample rate by repeating every Kth input sample K times at the output).
The method by which to implement downsampling for frame-based inputs: Maintain input frame size (decrease the frame rate), or Maintain input frame rate (decrease the frame size).
| Port | Supported Data Types |
|---|---|
Input |
|
Output |
|
| FIR Decimation | Signal Processing Blockset |
| FIR Rate Conversion | Signal Processing Blockset |
| Repeat | Signal Processing Blockset |
| Sample and Hold | Signal Processing Blockset |
| Upsample | Signal Processing Blockset |
![]() | Display | DSP Constant (Obsolete) | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |