where u(t) is a square
wave with an amplitude of
1 and a frequency of
use an integrator block and a gain block. The Integrator
block integrates its input x´ to produce x.
Other blocks needed in this model include a Gain block and a Sum block.
To generate a square wave, use a Signal Generator block and select
the Square Wave form but change the default units to radians/sec.
Again, view the output using a Scope block. Gather the blocks and
define the gain.
In this model, to reverse the direction of the Gain block, select the block, then use the Diagram > Rotate & Flip > Flip Block command. To create the branch line from the output of the Integrator block to the Gain block, hold down the Ctrl key while drawing the line. For more information, see Branch a Connection.
Now you can connect all the blocks.
An important concept in this model is the loop that includes the Sum block, the Integrator block, and the Gain block. In this equation, x is the output of the Integrator block. It is also the input to the blocks that compute x´, on which it is based. This relationship is implemented using a loop.
The equation you modeled in this example can also be expressed as a transfer function. The model uses the Transfer Fcn block, which accepts u as input and outputs x. So, the block implements x/u. If you substitute sx for x´ in the above equation, you get
sx = –2x + u.
Solving for x gives
x = u/(s + 2)
x/u = 1/(s + 2).
The Transfer Fcn block uses parameters to specify the numerator
and denominator coefficients. In this case, the numerator is
the denominator is
s+2. Specify both terms as vectors
of coefficients of successively decreasing powers of
In this case the numerator is
1) and the denominator is
The results of this simulation are identical to those of the previous model.