Generate Sinusoidal Output from VCO
This example shows how to modify the Ring Oscillator VCO from the Mixed-Signal Blockset™ to generate a sine wave output. This approach focuses on ideal behavior without modeling impairments like jitter or phase noise. Modeling noise is explicitly out of scope for this work. This example also provides modeling solution for both discrete time and continuous time output.
Overview of Conversion Process for Discrete Time VCO
Start with the Mixed-Signal Blockset VCO block and configure it without enabling phase noise. Then use the command
set_param(gcb, 'LinkStatus', 'none')to make the block editable.The original Ring Oscillator VCO from Mixed-Signal Blockset™ outputs a pulse train whose frequency depends on the control voltage. To generate a sine wave, the process involves:Computing instantaneous frequency from the half-period.
Converting frequency to angular frequency.
Integrating angular frequency to obtain phase.
Wrapping phase between
and
and adding an initial offset.Generating sine wave from the accumulated phase.
Mathematical Foundations
The conversion relies on the following equations:
Instantaneous frequency:

Angular frequency:

Phase accumulation:

Phase wrapping:

Sine wave output:

Editing Ring Oscillator VCO
This section represents the original output from the Ring Oscillator VCO block, which consists of an ideal pulse train. The pulse train serves as the foundation for extracting timing information that you can convert into a smooth sine wave.
Once you make the block editable by running the command set_param(gcb,'LinkStatus','none') , you can see the inner structure of the VCO that needs to be modified.
Then you can convert the pulse train to a sine wave through following steps:
1. Calculating Instantaneous Frequency
To monitor the time-varying performance of the VCO, the instantaneous frequency is calculated based on the half-period data
generated by the original ring oscillator VCO. Using half-period measurements allows for a higher-resolution frequency update rate compared to full-period measurements. The frequency is determined by doubling the half-period to approximate the full wavelength and taking the inverse which can be mathematically represented as 
2. Deriving Angular Frequency
The next stage in the signal chain involves translating the instantaneous frequency into angular frequency via the formula
This conversion bridges the domain gap between frequency and phase. While describes the number of cycles per second, phase processing requires the signal to be expressed in radians per second. By calculating
, you can establish the instantaneous rate of change of the phase, preparing the data for the integration process that follows.
3. Deriving Instantaneous Phase
The next step in the signal chain is the derivation of the instantaneous phase,
, by integrating the angular frequency over time:
In the digital domain, this process is modeled as a continuous accumulation of phase increments. The Discrete-Time Integrator block is configured with the following specific parameters to ensure accurate conversion:
Integrator Method (Forward Euler): This method was selected for its computational efficiency and simplicity in handling discrete-time updates. It approximates the integral by adding the product of the current input and the sample time to the previous state.
Gain Value (1.0): A unity gain is applied to ensure the angular frequency is integrated directly without any additional scaling or attenuation.
Initial Condition (0): The integrator is initialized to zero to establish a consistent starting phase reference ().
Sample Time: For GHz-range VCOs, the sample time is set to an extremely small interval (e.g.,1/(128*2.5e9)). This significant oversampling is critical to capturing the fast-changing dynamics of the oscillator without aliasing artifacts.
Critical Implementation Considerations:
Sampling & Aliasing: For lower-frequency VCOs, the sample time can be relaxed, but it must strictly adhere to the Nyquist-Shannon sampling theorem to prevent signal distortion.
Numerical Stability: While Forward Euler is efficient, very small sample times can occasionally lead to numerical precision issues. If you observe any instability, you can either tune the solver settings or consider a more robust integration method like Trapezoidal.
Phase Wrapping: Since the integrator output grows indefinitely, apply a modulo operations downstream. This wraps the accumulated phase into the standard range required for trigonometric function evaluations.
Dynamic Range: Saturation limits are typically set to to prevent artificial clipping of the phase growth. However, in long-duration simulations, you can impose limits to prevent variable overflow.
4. Wrapping Phase and Adding Offset
The output of the integrator is an unbounded ramp signal. To convert this into a usable periodic phase argument for trigonometric functions, you must wrap the value within a standard circle of [
,
] :
. Before wrapping, inject an initial phase offset
. This allows for calibration of the wave's starting point. By adding
and subsequently applying a modulo
operation, you can prevent numerical overflow and ensure the signal phase resets correctly at the end of every cycle.
5. Generating Sine Wave
The final stage of the signal chain transforms the instantaneous phase argument into a time-domain amplitude. By applying the trigonometric sine function to the wrapped phase input, you can compute the output using the equation:
. This non-linear mapping converts the sawtooth-like phase ramp into a smooth, periodic sinusoidal waveform. The resulting signal oscillates within the range
(where
is the peak amplitude), making it spectrally pure and suitable for use as a local oscillator in RF mixers or communication systems.
Discrete Time VCO Simulation
Run the attached model VCO_sine which is configured with voltage sensitivity of 100MHz/Volt, free running frequency of 2.4GHz, amplitude of 1 Volt and with an initial phase of
/2 in the sinusoidal output. For a 1 Volt of control voltage we expect the VCO to be generating a sinusoidal output of 2.5GHz frequency. Accordingly, the sample time has been set as 1/(64*2.5e9) producing 64 points in one cycle of sine wave output
model='VCO_discrete'; load_system(model); open_system([model,'/VCO']); open_system([model,'/VCO/Variant Subsystem/DT-VCO/Ring Oscillator VCO'],'force','tab'); sim(model); open_system([model,'/Scope']); %


Overview of Conversion Process for Continuous Time VCO
The instantaneous frequency for a voltage controlled oscillator is
where,
= free running frequency (Hz)
= Voltage sensitivity of VCO (Hz/Volt)
= Control voltage
Angular frequency and phase evolve as 
The sinusoidal output with amplitude
and initial phase
is:

Above math is used to implement the VCO which is shown in the next section
Continuous Time VCO Simulation
model='VCO_continuous'; load_system(model); open_system([model,'/VCO']); open_system([model,'/VCO/Variant Subsystem/CT-VCO'],'force','tab'); sim(model); open_system([model,'/Scope']);

