# Variable Pulse Generator

Generate ideal, time varying pulse signal

Since R2020b

Libraries:

## Description

Use the Variable Pulse Generator block to create ideal modulated pulse signals.

Generally speaking, the output pulse of the block is described by

`$y\left(t\right)=\left\{\begin{array}{cc}1& {t}_{k}`

where pw is the output pulse width.

For an implementation of Pulse Width Modulation, see PWM.

## Ports

### Input

expand all

Desired duty cycle of the pulse P, specified as scalar within the range [0,1].

Data Types: `double`

Time between rising edges of consecutive pulses of the output signal. A smaller value represents a higher frequency pulse.

Data Types: `double`

### Output

expand all

Modulated output pulse signal corresponding to input duty cycle.

Data Types: `double`

## Parameters

expand all

Enable this parameter to allow the output pulse signal to support pulses of width 0.

Note

Enabling this parameter causes the block to have direct feedthrough. This can cause algebraic loops in your model.

Select whether the block should operate in continuous or discrete sampling modes.

By default, the block uses `continuous` sampling mode as it improves simulation performance with variable step solvers.

Select `discrete` sampling mode if you need to:

• use a fixed-step solver

• generate code

• sample the block output

Specify the rate at which the block samples input duty cycle signal. This sampling rate becomes the resolution of the output pulse signal.

#### Dependencies

This parameter requires that Sampling mode is set to `discrete`

## Block Characteristics

 Data Types `double` Direct Feedthrough `no` Multidimensional Signals `no` Variable-Size Signals `no` Zero-Crossing Detection `no`

expand all

## Version History

Introduced in R2020b