Documentation Center

  • Trial Software
  • Product Updates

Build a Simple Actuator System

Build the Model

The Simulink® product is a software environment for modeling, simulating, and analyzing dynamic systems. Try building a simple model that drives an actuator with a sine wave and displays the actuator's position superimposed on the sine wave.

    Note   If you prefer to open the complete model shown below instead of building it, enter aeroblktutorialaeroblktutorial at the MATLAB® command line.

The following section (Create a Model) explains how to build a model on Windows® platforms. You can use this same procedure to build a model on Linux® platforms.

The section describes how to build the model. It does not describe how to set the configuration parameters for the model. See Configuration Parameters Dialog Box Overview. That topic describes the Configuration Parameters Dialog Box for models. If you do not set any configuration parameters, simulating models might cause warnings like:

Warning: Using a default value of 0.2 for maximum step size.  
The simulation step size will be equal to or less than this 
value.  You can disable this diagnostic by setting 
'Automatic solver parameter selection' diagnostic to 'none' 
in the Diagnostics page of the configuration parameters 
dialog 

Create a Model

  1. Click the button in the MATLAB Toolstrip or enter simulinksimulink at the MATLAB command line. The Simulink library browser appears.

  2. Select New > Model from the File menu in the Library Browser. A new model window appears on your screen.

  3. Add a Sine Wave block to the model.

    1. Click Sources in the Library Browser to view the blocks in the Simulink Sources library.

    2. Drag the Sine Wave block from the Sources library into the new model window.

  4. Add a Linear Second-Order Actuator block to the model.

    1. Click the  symbol next to Aerospace Blockset in the Library Browser to expand the hierarchical list of the aerospace blocks.

    2. In the expanded list, click Actuators to view the blocks in the Actuator library.

    3. Drag the Linear Second-Order Actuator block into the model window.

  5. Add a Mux block to the model.

    1. Click Signal Routing in the Library Browser to view the blocks in the Simulink Signals & Systems library.

    2. Drag the Mux block from the Signal Routing library into the model window.

  6. Add a Scope block to the model.

    1. Click Sinks in the Library Browser to view the blocks in the Simulink Sinks library.

    2. Drag the Scope block from the Sinks library into the model window.

  7. Resize the Mux block in the model.

    1. Click the Mux block to select the block.

    2. Hold down the mouse button and drag a corner of the Mux block to change the size of the block.

  8. Connect the blocks.

    1. Position the pointer near the output port of the Sine Wave block. Hold down the mouse button and drag the line that appears until it touches the input port of the Linear Second-Order Actuator block. Release the mouse button.

    2. Using the same technique, connect the output of the Linear Second-Order Actuator block to the second input port of the Mux block.

    3. Using the same technique, connect the output of the Mux block to the input port of the Scope block.

    4. Position the pointer near the first input port of the Mux block. Hold down the mouse button and drag the line that appears over the line from the output port of the Sine Wave block until double crosshairs appear. Release the mouse button. The lines are connected when a knot is present at their intersection.

  9. Set the block parameters.

    1. Double-click the Sine Wave block. The dialog box that appears allows you to set the block's parameters.

      For this example, configure the block to generate a 10 rad/s sine wave by entering 10 for the Frequency parameter. The sinusoid has the default amplitude of 1 and phase of 0 specified by the Amplitude and Phase offset parameters.

    2. Click OK.

    3. Double-click the Linear Second-Order Actuator block.

      In this example, the actuator has the default natural frequency of 150 rad/s, a damping ratio of 0.7, and an initial position of 0 radians specified by the Natural frequency, Damping ratio, and Initial position parameters.

    4. Click OK.

Run the Simulation

You can now run the model that you built to see how the system behaves in time:

  1. Double-click the Scope block if the Scope window is not already open on your screen. The Scope window appears.

  2. Select Run from the Simulation menu in the model window. The signal containing the 10 rad/s sinusoid and the signal containing the actuator position are plotted on the scope.

  3. Adjust the Scope block's display. While the simulation is running, right-click the y-axis of the scope and select Autoscale. The vertical range of the scope is adjusted to better fit the signal.

  4. Vary the Sine Wave block parameters.

    1. While the simulation is running, double-click the Sine Wave block to open its parameter dialog box.

    2. You can then change the frequency of the sinusoid. Try entering or 20 in the Frequency field. Close the Sine Wave dialog box to enter your change. You can then observe the changes on the scope.

  5. Select Stop from the Simulation menu to stop the simulation.

Many parameters cannot be changed while a simulation is running. This is usually the case for parameters that directly or indirectly alter a signal's dimensions or sample rate. However, there are some parameters, like the Sine Wave Frequency parameter, that you can tune without stopping the simulation.

Run a Simulation from a Script

You can also modify and run a Simulink simulation from a script. By doing this, you can automate the variation of model parameters to explore a large number of simulation conditions rapidly and efficiently. For information on how to do this, see About Programmatic Simulation.

Was this topic helpful?