Variable Pulse Generator
Generate ideal, time varying pulse signal
Libraries:
Simulink /
Discontinuities
Description
Use the Variable Pulse Generator block to create ideal modulated pulse signals.
Generally speaking, the output pulse of the block is described by
where pw is the output pulse width.
For an implementation of Pulse Width Modulation, see PWM.
Examples
This example shows you how to model an ideal voltage controlled oscillator using the Variable Pulse Generator block to create the frequency oscillations.
A voltage controlled oscillator uses an input tuning voltage to produce waveforms of varying frequency. Over a small range of voltages, the relationship between the input voltage ()and the output oscillation frequency (
) is proportional and can be expressed as
where
is the oscillator sensitivity in Hz/V
is the quiescent frequency, or nominal frequency of the oscillator at
In the included vco_using_vpg
model, the desired oscillation frequency signal F_{in}(t)
is generated using the formula shown in equation (1). In this model, the tuning voltage is a sinusoidal waveform.
Ports
Input
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
Modulated output pulse signal corresponding to input duty cycle.
Data Types: double
Parameters
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 |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Algorithms
For a pulse starting at time tk
where pw is the pulse width. For a given period P, pw is proportional to the duty cycle D
In Discrete sampling mode, the input duty cycle signal is sampled at the rate specified by the Run at fixed time intervals parameter.
For a specified sampling rate tS , the number of samples needed for a pulse of width pw can be expressed as follows
where nP is the number of samples needed to simulate a pulse of period P.
Consider a nominal pulse of period P with the sampling rate of the block set to be tS= 0.25 P. The number of samples needed for one period of the pulse, nP= 4. Thus, for the input duty cycle D= 0.47 , the number of samples n pw is floored to = 1. Therefore, the pulse is high for 1 of the 4 samples in the period.
Extended Capabilities
Not recommended for production-quality code. Relates to resource limits and restrictions on speed and memory often found in embedded systems. The code generated can contain dynamic allocation and freeing of memory, recursion, additional memory overhead, and widely-varying execution times. While the code is functionally valid and generally acceptable in resource-rich environments, smaller embedded targets often cannot support such code.
In general, consider using the Simulink Model Discretizer to map continuous blocks into discrete equivalents that support production code generation. To start the Model Discretizer, in the Simulink® Editor, on the Apps tab, under Apps, under Control Systems, click Model Discretizer. One exception is the Second-Order Integrator block because, for this block, the Model Discretizer produces an approximate discretization.
Version History
Introduced in R2020b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)