MATLAB Examples

Triangle Wave Generator

This example shows an implementation of a triangle wave generator circuit using two op-amps. The first stage of the circuit is a comparator constructed from an op-amp. The output of the comparator is limited to about plus or minus 5 volts by the two zener diodes. The limits imposed by the zener diodes result in a square wave.

The second stage of the circuit is an integrator. Integrating the square wave creates a triangle wave. The Sine Wave block modulates the waveform amplitude via the Variable Resistor block, and the DC Voltage Source can be used to add a DC offset. See the Example - Modeling a Triangle Wave Generator section of the Simscape™ Electronics™ User Guide for more information on how to construct this model using the Simscape™ and Simscape Electronics block libraries.

The two Band-Limited Op-Amp blocks are parameterized based on an LM7301 device. The datasheet gives the gain as 97dB which is equivalent to a gain of 10^(97/20)=7.1e4. Input resistance is given as 39e6 ohms, and slew rate as 1.25V per microsecond. Bandwidth is given as 4MHz. No value is given for the output resistance, so this is set to zero. In practice the output resistance will be small compared to output series 1000 ohm resistor in this circuit.

Contents

Model

Simulation Results from Simscape Logging

The plot below shows the output voltage of each stage for the triangle wave circuit. The comparator with limits imposed by the zener diodes creates a square wave. Integrating the square wave produces a triangle wave.