DSP Blockset | ![]() ![]() |
Resample an input at a higher rate by inserting zeros.
Library
Description
The Upsample block resamples each channel of the Mi-by-N input at a rate L times higher than the input sample rate by inserting L-1 zeros between consecutive samples. The integer L is specified by the Upsample factor parameter. The Sample offset parameter delays the output samples by an integer number of sample periods D, where 0 D < (L-1), so that any of the L possible output phases can be selected.
Sample-Based Operation
When the input is sample-based, the block treats each of the M*N matrix elements as an independent channel, and upsamples each channel over time. The Frame-based mode parameter must be set to Maintain input frame size. The output sample rate is L times higher than the input sample rate (Tso = Tsi/L), and the input and output sizes are identical.
Frame-Based Operation
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 upsamples each channel independently by inserting L-1 rows of zeros between each row in the input matrix. The Frame-based mode parameter determines how the block adjusts the rate at the output to accommodate the added rows. There are two available options:
The model below shows a single-channel input with a frame period of 1 second being upsampled by a factor of 4 to a frame period of 0.25 second. The input and output frame sizes are identical.
The model below shows a single-channel input of frame size 16 being upsampled by a factor of 4 to a frame size of 64. The input and output frame rates are identical.
Latency and Initial Conditions
Zero Latency. The Upsample block has zero tasking latency for all single-rate operations. The block is single-rate for the particular combinations of sampling mode and parameter settings shown in the table below.
Sampling Mode |
Parameter Settings |
Sample-based |
Upsample factor parameter, L, is 1 . |
Frame-based |
Upsample factor parameter, L, is 1 , or Frame-based mode parameter is Maintain input frame rate. |
The block also has zero latency for all multirate operations in the Simulink single-tasking mode.
Zero tasking latency means that the block propagates the first input (received at t=0) immediately following the D consecutive zeros specified by the Sample offset parameter. This output (D+1) is followed in turn by the L-1 inserted zeros and the next input sample. The Initial condition parameter value is not used.
Nonzero Latency. The Upsample block has tasking latency only for multirate operation in the Simulink multitasking mode:
See Excess Algorithmic Delay (Tasking Latency) and "The Simulation Parameters Dialog Box" in the Simulink documentation for more information about block rates and the Simulink tasking modes.
Example
Construct the frame-based model shown below.
Adjust the block parameters as follows:
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, select Fixed-step and discrete from the Type controls in the Solver panel of the Simulation Parameters dialog box, and select MultiTasking from the Mode parameter. Also set the Stop time to 30
.
Run the model and look at the output, yout
. The first few samples of each channel are shown below.
Since we ran this frame-based multirate model in multitasking mode, the first row of the initial condition matrix appears as output sample 2 (i.e., sample D+1, where D is the Sample offset value). It is followed by the other three initial condition rows, each separated by L-1 inserted rows of zeros, where L is the Upsample factor value of 2. The first row of the first input matrix appears in the output as sample 10 (i.e., sample MiL+D+1, where Mi is the input frame size).
Dialog Box
Supported Data Types
To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
Downsample |
DSP Blockset |
FIR Interpolation |
DSP Blockset |
FIR Rate Conversion |
DSP Blockset |
Repeat |
DSP Blockset |
Also see Signal Operations for a list of all the blocks in the Signal Operations library.
![]() | Unwrap | Variable Fractional Delay | ![]() |