# Tutorial: Simulating a Hybrid Model

Learn how to model and simulate a simple hybrid system that includes discrete signals and continuous linear systems.

## Files for This Tutorial

HybridSystem.scm

`<installation_directory>`/tutorial_models/.

## Overview

The model in this tutorial includes DiscreteDelay blocks to generate a square-wave signal that is fed into the input of a continuous-time linear system. The continuous-time linear system is represented by its transfer function via a ContTransFunc block. A Scope block plots the output of the system.

`s`. If the differential equation represents the input-output behavior of a system in the time domain, the resulting equation in the Laplace domain can be used to obtain the system’s transfer functions. For example, the linear differential equation: yields the transfer function: The ContTransFunc block can represent a system’s single-input, single- or possible multi-output, transfer function. The block parameters contain the coefficients of the transfer function’s denominator and numerator(s). A special case of the transfer function is an integrator, such as represented by the Integral block. In discrete-time, transfer functions are obtained by applying the Z transform to difference equations. The special case of a unit delay operator is represented by the DiscreteDelay block. This block is usually activated periodically by a SampleClock block, which fixes the period and phase of the activations. Discrete-time signals are updated at activation times and remain constant from one activation to the next.

## Constructing a Discrete Signal

Construct discrete signals with the DiscreteDelay block.

## Creating a Continuous Transfer Function

Represent continuous linear systems with the ContTransFunc block.

## Simulating the Hybrid Model

Set simulation parameters and run a simulation.

## Reviewing Simulation Data

Examine the data in the plots generated from the Scope block.