| Simulink® | ![]() |
Sources
The Pulse Generator block generates square wave pulses at regular intervals. The block's waveform parameters, Amplitude, Pulse Width, Period, and Phase Delay, determine the shape of the output waveform. The following diagram shows how each parameter affects the waveform.

The Pulse Generator can emit scalar, vector, or matrix signals of any real data type. To cause the block to emit a scalar signal, use scalars to specify the waveform parameters. To cause the block to emit a vector or matrix signal, use vectors or matrices, respectively, to specify the waveform parameters. Each element of the waveform parameters affects the corresponding element of the output signal. For example, the first element of a vector amplitude parameter determines the amplitude of the first element of a vector output pulse. All the waveform parameters must have the same dimensions after scalar expansion. The data type of the output is the same as the data type of the Amplitude parameter.
The block's Pulse type parameter allows you to specify whether the block's output is time-based or sample-based. If you select sample-based, the block computes its outputs at fixed intervals that you specify. If you select time-based, Simulink® software computes the block's outputs only at times when the output actually changes. This can result in fewer computations being required to compute the block's output over the simulation time period.
Depending on the pulse's waveform characteristics, the intervals between changes in the block's output can vary. For this reason, a time-based Pulse Generator block is said to have a variable sample time. Simulink software uses brown as the sample time color of such blocks (see Displaying Sample Time Colors for more information).
Simulink software cannot use a fixed-step solver to compute the output of a time-based pulse generator. If you specify a fixed-step solver for models that contain time-based pulse generators, Simulink software computes a fixed sample time for the time-based pulse generators. It then simulates the time-based pulse generators as sample-based.
Note If you use a fixed-step solver and the Pulse type is time-based, you must choose the step size such that the period, phase delay, and pulse width (in seconds) are integer multiples of the step size. For example, suppose that the period is 4 seconds, the pulse width is 75% (i.e., 3 s), and the phase delay is 1 s. In this case, the computed sample time is 1 s. Therefore, you must choose a fixed-step size that is 1 or that divides 1 exactly (e.g., 0.25). You can guarantee this by setting the fixed-step solver's step size to auto on the Configuration Parameters dialog box. |
If you select time-based as the block's pulse type, you must specify the pulse's phase delay and period in units of seconds. If you specify sample-based, you must specify the block's sample time in seconds, using the Sample Time parameter, then specify the block's phase delay and period as integer multiples of the sample time. For example, suppose that you specify a sample time of 0.5 second. And suppose you want the pulse to repeat every two seconds. In this case, you would specify 4 as the value of the block's Period parameter.
The Pulse Generator block outputs real signals of any data type supported by Simulink software, including fixed-point data types. The data type of the output signal is the same as that of the Amplitude parameter.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink® in the Simulink documentation.

Opening this dialog box causes a running simulation to pause. See Changing Source Block Parameters During Simulation in the online Simulink documentation for details.
The pulse type for this block: time-based or sample-based. The default is time-based.
Specifies whether to use simulation time or an external signal as the source of values for the output signal's time variable. If you specify an external source, the block displays an input port for connecting the source.
The pulse amplitude. The default is 1.
The pulse period specified in seconds if the pulse type is time-based or as number of sample times if the pulse type is sample-based. The default is 2.
The duty cycle specified as the percentage of the pulse period that the signal is on if time-based or as number of sample times if sample-based. The default is 50 percent.
The delay before the pulse is generated specified in seconds if the pulse type is time-based or as number of sample times if the pulse type is sample-based. The default is 0 seconds.
The length of the sample time for this block in seconds. This parameter appears only if the block's pulse type is sample-based. See Specifying Sample Time for more information.
If you select this option and the other parameters are one-row or one-column matrices, after scalar expansion, the block outputs a 1-D signal (vector). Otherwise the output dimensionality is the same as that of the other parameters. See Determining the Output Dimensions of Source Blocks.
Sample Time | Inherited |
Scalar Expansion | Yes, of parameters |
Dimensionalized | Yes |
Zero Crossing | No |
![]() | Probe | Quantizer | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |