Main Content

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 Editor opens.

  3. On the Simulation tab, click 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:

    [10000]
    

    In the Denominator text box, enter:

    [1 70 10000]
    

    Click OK.

    Configure the transfer function by using the block parameters window.

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

    In the Amplitude text box, enter:

    1

    In the Frequency text box, enter:

    20

    From the Units list, select rad/sec.

    Click OK.

    Configure the signal generator by using the block parameters window.

    The completed Simulink block diagram looks like the figure.

    The updated model subsystem sldrtex_model/rtwin displays the changes.

  8. In the Simulink Editor, on the Simulation tab, click Save > Save as. In the File name text box, enter a file name for your Simulink model and click Save. For example, type:

    sldrtex_model
    

    The Simulink software saves your model in the file sldrtex_model.

The Simulink Desktop Real-Time software supports model referencing. See Model Reference Basics.

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.

Related Topics