DSP Blockset    
N-Sample Switch

Switch between two inputs after a specified number of sample periods.

Library

Signal Management / Switches and Counters

Description

The N-Sample Switch block outputs the signal connected to the top input port during the first N sample times after the simulation begins or the block is reset, where N is specified by the Switch count value. Beginning with output sample N+1, the block outputs the signal connected to the bottom input until the next reset event or the end of the simulation.

The sample period of the output is specified by the Sample time parameter (i.e., the output sample period is not inherited from the sample period of either input). The block applies a zero-order hold at the input ports, so the value the block reads from a given port between input sample times is the value of the most recent input to that port.

Both inputs must have the same dimension, except in the following two cases:

The inputs must either both be frame-based or both be sample-based.

The Reset input check box enables the Rst input port. At any time during the count, a trigger event at the Rst port resets the counter to zero. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input.

The triggering event is specified by the Trigger type pop-up menu, and can be one of the following:

Dialog Box

Switch count
The number of sample periods, N, for which the output is connected to the top input before switching to the bottom input. Tunable.
Reset input
Enables the Rst input port when selected. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input.
Trigger type
The type of event at the Rst port that resets the block's counter. This parameter is enabled when Reset input is selected. Tunable.
Sample time
The sample period, Ts, for the block's counter. The block switches inputs at t=Ts*(N+1).

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

Counter
DSP Blockset
N-Sample Enable
DSP Blockset

Also see Switches and Counters for a list of all the blocks in the Switches and Counters library.


  N-Sample Enable Normalization