Handle state events. Run the simulation and see the phase plane plot, where the state x1 is along the X-axis and the state x2 is along the Y-axis.
Use Simulink® to create a model with four hydraulic cylinders. See two related examples that use the same basic components: single cylinder model and model with two cylinders and load
How zero crossings work in Simulink®. In this model, three shifted sine waves are fed into an absolute value block and saturation block. At exactly t = 5, the output of the switch block changes
Use Flip-Flop blocks (found in the Simulink® Extras Library) to implement a Modulo-4 counter. The model takes the output of a Modulo-4 counter and generates a half clock cycle width pulse on
Use Stateflow® to model a bang-bang temperature control system for a boiler. The boiler dynamics are modeled in Simulink®.
Use Simulink® to create the thermal model of a house. This system models the outdoor environment, the thermal characteristics of the house, and the house heating system.
The example shows how to use Simulink® to explore the solver Jacobian sparsity pattern, and the connection between the solver Jacobian sparsity pattern and the dependency between
Approximate nonlinear relationships of a type S thermocouple.
Model friction one way in Simulink®. The two integrators in the model calculate the velocity and position of the system, which is then used in the Friction Model to calculate the friction
Some of the main steps needed to design and evaluate a sine wave data table for use in digital waveform synthesis applications in embedded systems and arbitrary waveform generation
Model a rigid rod supporting a large mass interconnecting two hydraulic actuators. The model eliminates the springs as it applies the piston forces directly to the load. These forces
Use two different approaches to modeling a bouncing ball using Simulink®.
Use Simulink® to model a hydraulic cylinder. You can apply these concepts to applications where you need to model hydraulic behavior. See two related examples that use the same basic
Choose the correct zero-crossing location algorithm, based on the system dynamics. For Zeno dynamic systems, or systems with strong chattering, you can select the adaptive zero-crossing
Model a double spring-mass-damper system with a periodically varying forcing function. Associated with the example is an animation function that will automatically open a figure window
Model a Foucault pendulum. The Foucault pendulum was the brainchild of the French physicist Leon Foucault. It was intended to prove that Earth rotates around its axis. The oscillation plane
Two cases where you can use Simulink® to model variable transport delay phenomena.
Model an inverted pendulum. The animation is created using MATLAB® Handle Graphics®. The animation block is a masked S-function. For more information, use the context menu to look under the
The behaviour of variable-step solvers in a Foucault pendulum model. Simulink® solvers ode45, ode15s, ode23, and ode23t are used as test cases. Stiff differential equations are used to
Model the dynamics of liquid in a tank. The associated animation provides a graphical display of the tank as it empties and refills, based on user-defined tank parameters. The tank empties at
This model was inspired by the classic paper "Galactic Bridges and Tails" (Toomre & Toomre 1972). The original paper explained how disc shaped galaxies could develop spiral arms. Two disc
This model shows the contrast between enabled subsystems and triggered subsystems for the same control signal, through the use of counter circuits. After running the simulation, the scope
Combine Stateflow® with Simulink® to efficiently model hybrid systems. This type of modeling is particularly useful for systems that have numerous possible operational modes based on
Simulate the working of an automatic climate control system in a car using Simulink® and Stateflow®. You can enter a temperature value you would like the air in the car to reach by double
Model an automotive drivetrain with Simulink®. Stateflow® enhances the Simulink model with its representation of the transmission control logic. Simulink provides a powerful
Simulate the electrical system of a vehicle using Simulink® and Simscape™ Power Systems™.
Model a simplified half-car model that includes an independent front and rear vertical suspension. The model also includes body pitch and bounce degrees of freedom. The example provides a
Interface the vehicle climate control system with a model of the electrical system to examine the loading effects of the climate control system on the entire electrical system of the car.
Model a simple model for an Anti-Lock Braking System (ABS). It simulates the dynamic behavior of a vehicle under hard braking conditions. The model represents a single wheel, which may be
Enhance a version of the open-loop engine model (sldemo_engine - described in "Modeling Engine Timing Using Triggered Subsystems" example). This model, sldemo_enginewc, contains a
Model a four-cylinder spark ignition internal combustion engine from the throttle to the crankshaft output. We used well-defined physical principles supplemented, where appropriate,
Use data dictionaries to manage the data for a fuel rate control system designed using Simulink® and Stateflow®. To familiarize yourself with the fuel rate control model see
Use MathWorks® software and the Model-Based Development process to go from concept to implementation for a power window system for an automobile.
Use Simulink® to model and simulate a rotating clutch system. Although modeling a clutch system is difficult because of topological changes in the system dynamics during lockup, this
Use the model of the missile airframe presented in a number of published papers (References ,  and ) on the use of advanced control methods applied to missile autopilot design. The
Use an extended Kalman filter with the MATLAB® Function block in Simulink® to estimate an aircraft's position from radar measurements. The filter implementation is found in the MATLAB
Model a conceptual air traffic control (ATC) radar simulation based on the radar range equation.
Use the Control System Toolbox™ and Simulink® Control Design™ to interact with Simulink to design a digital pitch control for the aircraft. In this example, we will design the controller to
Model six degrees of freedom motion in Simulink®. You can switch between using Euler Angles and Quaternions to model the equations of motion, using the Variant Subsystem block's "Variant >
How one of the engineers who worked on the Apollo Lunar Module digital autopilot design team would have done it using Simulink® if it had been available in 1961.
Model flight control for the longitudinal motion of an aircraft. First order linear approximations of the aircraft and actuator behavior are connected to an analog flight control design
Generate a movie with 64 frames and a frame size of 64 by 64 pixels (at 10 frames per second). The movie contains a simulation of a moving target that is moving through a structured background
Use anti-windup schemes to prevent integration wind-up in PID controllers when the actuators are saturated. We use the PID Controller block in Simulink® which features two built-in
Regulate the speed of an electric motor using two degrees-of-freedom PID control with set-point weighting. We use the PID Controller (2DOF) block in Simulink® as shown below.
How clients, in this case three computers, can send jobs to a server, a printer, and receive status from that server. This example highlights how Simulink Functions can be called from
How the Simulink® Project's checks support upgrading from MDL format model files to SLX format. The default file format for Simulink models in R2012b and subsequent releases is SLX.
Convert a Simulink® model that is parameterized by unstructured workspace variables to a model that is parameterized by a MATLAB® structure. The example uses a number of Simulink utilities
This interactive example discretizes the Actuator Model in an aircraft Simulink® model.
Use MATLAB System blocks to illustrate the law of large numbers.
This set of examples shows different types of Simulink® Subsystems and what semantics are used when simulating these Subsystems. Each example provides a description of the model and the
This library launches examples of different types of Simulink® S-functions. Simulink S-functions allow you to extend Simulink with new hand coded blocks, interface to custom external
Use Model Reference. It walks you through simulation and code generation of a model that references another model multiple times.
Convert a harness model that uses a Signal Builder block as an input to a harness-free model with root inports. The example collects data from the harness model and stores it in MAT-files, for
Create a custom mapping function for the Root Inport Mapping tool. The Root Inport Mapper tool associates MAT-file data with a specific input port, based on one of these criteria.
Use the Legacy Code Tool to integrate legacy C functions that pass their input arguments by value versus address.
Use the MATLAB System block to implement Simulink® blocks using a System object™. It highlights two MATLAB System blocks. Access the MATLAB source code for each System object by clicking the
What happens when a sine wave is fed into an If block. After running the simulation, the scope shows three plots. This example is designed to compare the If block with enabled subsystems.
Use data types in Simulink. The model used in this example converts a double-precision sine wave having an amplitude of 150 to various data types and displays the converted signals on two
The Prelookup block allows you to minimize the number of index searches performed across a set of look-up tables and also to mix clipping, extrapolation, and index search algorithms within
Simulink® Accelerator™ speeds up the execution of your model, by creating and compiling C code that takes the place of the interpretive code that Simulink uses when in Normal mode (that is,
Use the Legacy Code Tool to integrate legacy C functions that pass their output as a return argument.
Create and use a protected model in Normal and Accelerated mode simulations, as well as for code generation.
Use a dynamic comet plot to visualize the result of changing the interpolation and extrapolation options for a 2-D data set running in an-D Lookup Table block. Algorithm options can be
Use a Simulink Project to manage the files within your design. Starting with an existing project that is already checked into source control, this example shows how to find and manage the
Use the Simulink Project dependency analysis tools to perform file-level impact analysis. Starting with an existing project that is already checked into SVN source control, this example
Use the MATLAB System block to create Simulink® blocks with variable-size input and output signals.
Use the Legacy Code Tool to integrate a C function whose arguments are pointers to structures.
Create a mask dialog box using the Parameters & Dialog pane of the Mask Editor. When you mask a block, you encapsulate the block logic and create a custom interface for the block.
Use a masked Variant Subsystem block in a Simulink model. Click the Open Model button located on the top right corner to view the related example model. This example model references masked
Define variant choice regions in the Variant Source and Sink blocks based on the block connectivity. The variant choice regions are computed by Simulink when you update diagram (Simulation
Use the Simulink project API to automate project tasks manipulating files, including working with modified files, dependencies, shortcuts, and labels.
When you select the Propagate conditions outside of variant subsystem check box in the Block Parameters dialog box, the Variant Subsystem adapts its interface to the connected blocks.
During variant condition propagation, Simulink automatically assigns conditions to blocks. You can control how the variant condition propagates upstream and downstream in a model.
Use a Bus Assignment block to change a bus element value without adding Bus Selector and Bus Creator blocks to select bus elements and reassemble them into a bus.
Use a Bus to Vector block to convert a bus signal to a vector, to provide a signal that the Gain block can accept.
A conditional subsystem (also known as a conditionally executed subsystem) is a type of subsystem where you can control the execution using an external signal.
This model illustrates Simulink® variant subsystems. Variant subsystems let you provide multiple implementations for a subsystem where only one implementation is active during
A Subsystem can be virtual or atomic. Simulink propagates variant conditions differently to such Subsystems. This example shows the propagation of variant conditions from Inline
Change a block parameter value between multiple programmatic simulation runs. Use this technique to determine an optimal parameter value by comparing the output signal data of each run.
Create reports using the Simulation Data Inspector programmatic interface. You can create a report for plotted signals in the Inspect pane or for comparison data in the Compare pane. This
Uses the slexAircraftExample model to demonstrate the comparison of the input and output signals for a control system. The example marks the signals for streaming then gets the run object
The capability of using the Simulink.HMI.InstrumentedSignals object to save a set of logged signals to restore after running a simulation with a different set of signals.
Continues from docid:simulink_ug.bso7lpv . You can also use this script to generate the data required for the example.
Create a run, add data to it, and then view the data in the Simulation Data Inspector.
You can change tolerance values on a signal-by-signal basis to evaluate the effect of a model parameter change. This example uses the slexAircraftExample model and the Simulation Data
Use Simulink® Support Package for Android™ Devices to design an algorithm and augment the same with a custom GUI.
Use Simulink® Support Package for Android Devices to run a Simulink model on an Android device.
Use blocks from the Simulink Support Package for Android Devices to create a Simulink® model and run it on an Android device.
Tune the parameters and monitor the signals of an algorithm running on an Android device.
Develop a Simulink® model for an image processing application - color detection by using Simulink Support Package for Android™ Devices.
Use Audio File Read and Audio Playback blocks from the Simulink® Support Package for Android™ Devices to implement a parametric audio equalizer algorithm with a Simulink model and run the
Use FromApp block from Simulink Support Package for Android™ Devices to receive data and add a touch interface in an Android application. This example demonstrates a workflow to customize
Use Raspberry Pi hardware board and an Android™ device to build a surveillance camera.
Use sliders and buttons from Simulink Support Package for Android® Devices to develop an interactive system for color replacement application
Prepare a Simulink® model that classifies human activity based on smartphone sensor signals for code generation and smartphone deployment. The example provides two Simulink models that
Control the brightness of the Arduino LED from an Android device.
Plot real-time data on an Android device by using the Simulink® Scope block with Simulink Support Package for Android Devices.
Create an Android™ app using Simulink® Support Package for Android Devices with Audio System Toolbox™ to implement a parametric audio equalizer.
Configure your Android™ device to send data over Bluetooth Low Energy(BLE) Protocol and receive that data on another Android device using the Simulink® Android BLE blocks.
Accept input values from the Android™ keyboard and convert it to a logical output using Simulink® Support Package for Android™ Devices.
Use the Accelerometer sensor data of an Android™ device to control the motion of a LEGO® MINDSTORMS® EV3 robot.
Use Audio Capture and Audio Playback blocks from the Simulink® Support Package for Apple iOS Devices to implement a parametric audio equalizer algorithm with a Simulink model and run the
Use Simulink® Support Package for Apple iOS Devices to design an algorithm and augment the same with a custom GUI.
Tune the parameters and monitor the signals of an algorithm running on an iOS device like iPhone, iPad or iPod.
Use blocks from the Simulink® Support Package for Apple iOS Devices to create a Simulink model and run it on an iPhone, iPod or an iPad.
Use Simulink Support Package for Apple iOS Devices to run a Simulink® model on an iPhone, iPod or an iPad.
Use Raspberry Pi® hardware and an Apple iOS device, such as iPhone or iPad, to build a surveillance camera.
Use FromApp block from Simulink® Support Package for Apple iOS Devices to receive data and add touch interface in an iOS application. This example demonstrates a workflow to develop
Use sliders and buttons from Simulink® Support Package for Apple iOS Devices to develop an interactive system for color replacement application
Develop a Simulink model for an image processing application - color detection by using Simulink® Support Package for Apple iOS Devices.
Plot vector or array data on an Apple iOS™ device using the Array Plot block in DSP System Toolbox™. To implement this workflow, you must install the Simulink Support Package for Apple iOS
Plot real-time data on an Apple iOS device by using the Simulink® Scope block with Simulink Support Package for Apple iOS Devices.
Connect an Apple iOS device to a LEGO® MINDSTROMS® EV3
Simulate a simple closed-loop control algorithm in Simulink® and how to run it on an Arduino® board.
Use Simulink® Support Package for Arduino Hardware to create a Simulink model to implement a smart plant watering system based on ThingSpeak.
Use Simulink Support Package for Arduino Hardware to run a Simulink® model on Arduino board.
Use Simulink Support Package for Arduino hardware to receive and send TCP/IP or UDP messages using an Arduino with an Ethernet Shield.
Control the brightness of the Arduino LED from an Android device.
Control the brightness of the Arduino LED from an Apple iOS device.
Create a line follower algorithm in Simulink® and how to run it on an Arduino Robot.
Use Simulink® Support Package for Arduino® Hardware to send and receive serial data with Arduino hardware.
Use Simulink Support Package for Arduino Hardware for code verification and validation using PIL.
Use Simulink® Support Package for Arduino® Hardware to receive serial data from a GPS shield on the Arduino hardware.
Tune the parameters and monitor the signals of an algorithm running on Arduino board.
Use Simulink® Support Package for Arduino Hardware to configure and read temperature from an I2C based sensor.
Use Simulink Support Package for Arduino hardware to receive and send TCP/IP or UDP messages over WiFi using Arduino boards.
Simulate a simple closed-loop control algorithm in Simulink® and how to run it on LEGO® MINDSTORMS® EV3™ hardware.
Tune the parameter values of and monitor the signals from an algorithm running on LEGO MINDSTORMS EV3 hardware.
Implement a line tracking algorithm for a two-wheeled robot built with LEGO® MINDSTORMS® EV3™ hardware.
Use Simulink Support Package for LEGO MINDSTORMS EV3 Hardware to run a Simulink® model on LEGO MINDSTORMS EV3 hardware.
Create a Simulink model to communicate between the Host PC and the LEGO MINDSTORMS EV3 robot. The Simulink model running on the Host PC will exchange data with the EV3 brick and control the
Use the External mode feature in Simulink® for speed control of motors on a PARROT® minidrone during runtime.
Use the TCP/IP and UDP communication blocks in the Simulink® Support Package for PARROT® Minidrones. The blocks are used to control the motor speed of the drone and visualize the
Use Raspberry Pi® hardware to interface to a motion sensor and control an external LED.
Use Simulink Support Package for Raspberry Pi Hardware to run a Simulink® models on Raspberry Pi hardware.
Use ALSA Audio Playback block from the Raspberry Pi® block library to implement a parametric audio equalizer algorithm with a Simulink® model and to run the model on Raspberry Pi hardware.
Use the V4L2 Video Capture and the SDL Video Display blocks from the Raspberry Pi® block library to implement an image inversion algorithm with a Simulink® model, and to run the model on
Use Raspberry Pi® hardware and an Apple iOS device, such as iPhone or iPad, to build a surveillance camera.
Stream images captured from a webcam on Raspberry Pi board to the host computer using ROS communication interface.
Generate and build a standalone ROS node from a Simulink model on the Raspberry Pi hardware.
Use Raspberry Pi® hardware and an Android device to build a surveillance camera.
Tune the parameters and monitor the signals of an algorithm running on Raspberry Pi board.
Simulate an audio visualizer on Sense HAT using the Simulink® Support Package for Raspberry Pi™ Hardware.
Demonstrates an application that counts the number of steps a person walked while holding a Raspberry Pi™ Sense HAT.
Develop a Simulink model to implement an algorithm to read the Accelerometer On-board Sense HAT and control the rotation of the image displayed on the LED matrix.
Illustrates how to use Simulink® Support Package for Raspberry Pi Hardware to configure and read temperature from a TMP102 sensor.
Use Simulink® Support Package for Raspberry Pi Hardware to read from and write to an SPI EEPROM.
Log signals from a Simulink® model on Raspberry Pi™ hardware in the MAT-file format.
Examples to use the Simulink model kalmanfilter. By Yi Cao at Cranfield University on 25 January 2008
- Low speed model is not perfect, review the effect on pneumatic trail (t) and aligning torque (Mz) - Turn slip equations needs to be reviewed, specially for Mz
This page provides examples of the commands needed to find library links in a model. For a graphical way to investigate library links, see the Model Advisor.
Illustrates a MATLAB® Coder™ based workflow for running MATLAB code on Raspberry Pi. MATLAB Coder generates readable and portable C / C++ code from MATLAB code, supporting most of the MATLAB
This demo shows how a model of a variable-step solver can be exploited to make stiff hybrid dynamic systems amenable to model checking technology. Specifically, a feedforward control
This demonstration shows how you can customize the Simulink graphical user interface (GUI).
Examples to run the Simulink model kalmanbucy in the command window. By Yi Cao at Cranfield University on 28 January 2008
This script file will show the following: 1) How to interrogate Simulink's state definition 2) leveraging Simulink's state definition to map to your own 3) aligning state definition with
Illustrates a workflow for modeling an audio processing application in MATLAB and deploying C/C++ code to create a standalone application on a Raspberry Pi. MATLAB coder generates
The sldemo_fuelsys model uses a Multiport Switch block in the fuel_rate_control/fuel_calc/feedforward_fuel_rate subsystem. This block uses the enumerated type sld_FuelModes to
Perform element-wise (.*) division of two inputs using the Divide block. In this example, the Divide block divides two scalars, a vector by a scalar, a scalar by a vector, and two matrices.
A model using the Squeeze block to eliminate a dimension of size 1.
Consider a point mass m suspended by a massless rod of length l under the influence of gravity. The position of the mass can be expressed in in Cartesian coordinates by (x,y).
The effect of the Dead Zone block on a sine wave. The model uses a dead zone lower limit of -0.5 and an upper limit as 0.5. Set these values through the parameters Start of Dead Zone and End of Dead
Two Selector blocks with the same kind of input signals, but two different Index Option settings.
Use the Find block to find nonzero elements in an array. In the following model, the block is configured to output both the one-based linear index and the value of each nonzero element.
Track the running minimum value of a signal generated by the Chirp Signal block.