Create a Simulink Model

Create a simple model of a damped square-wave generator. You can use this model as an example to learn other capabilities that are useful with Simulink® Desktop Real-Time™ software.

  1. In the MATLAB® Home tab, click the Simulink button.

  2. Click Blank Model, and then Create Model.

    An empty Simulink window opens.

  3. In the toolbar, open the Simulink Library Browser.

  4. In the Library Browser:

    • Select Simulink > Sources, and then add a Signal Generator block to the model.

    • Select Simulink > Continuous, and then add a Transfer Fcn block to the model.

    • Select Simulink > Sinks, and then add a Scope block to the model.

  5. Make the following block-to-block connections:

    • Signal Generator output to Transfer Fcn input

    • Transfer Fcn output to Scope input

  6. Double-click the Transfer Fcn block. The Block Parameters dialog box opens. In the Numerator text box, enter:


    In the Denominator text box, enter:

    [1 70 10000]

    Click OK.

  7. Double-click the Signal Generator block. From the Wave form list, select square.

    In the Amplitude text box, enter:


    In the Frequency text box, enter:


    From the Units list, select rad/sec.

    Click OK.

    The completed Simulink block diagram looks like the figure.

  8. From the File menu, click Save As. In the File name text box, enter a file name for your Simulink model and click Save. For example, type:


    The Simulink software saves your model in the file sldrtex_model (matlab: open_system(docpath(fullfile(docroot, 'toolbox', 'sldrt', 'examples', 'sldrtex_model')))).

The Simulink Desktop Real-Time software supports model referencing. See Overview of Model Referencing (Simulink).

The Simulink Desktop Real-Time software supports file I/O, with constraints. See File System I/O.

To specify a default Simulink Desktop Real-Time configuration set for your model, see Specify a Default Configuration Set. If you activate this configuration set for your model, you can build your real-time application later without setting additional configuration parameters.

To configure your model manually, see Enter Configuration Parameters Manually.

Was this topic helpful?