Control Tutorials for MATLAB and Simulink (2024)

Below you will find an extensive list of hardware-based activities that instructors and individuals can employ to learn the concepts behind the modeling, controller design, and controller implementation for dynamic systems. The activities as outlined employ an Arduino board (Uno, Mega 2560, etc.) interfaced with a host computer running MATLAB/Simulink, though the essence of the various activities can be achieved with alternative hardware and software platforms. Most of the activities employ the ArduinoIO package, though you can also use the standard Arduino Hardware Support Package. Both packages are freely available with the standard MATLAB/Simulink license. Details on these packages and their installation can be found by following the link below.

- ArduinoIO Package Installation and Introduction

Contents

  • RC Circuit
  • LRC Circuit
  • Simple Pendulum
  • Lightbulb
  • Boost Converter Circuit
  • DC Motor

RC Circuit

Overview: These activities employ a simple electrical circuit consisting of only a resistor and a capacitor. This type of circuit is a simple, but important, example of a dynamic system. The activities explore the modeling, analysis, and control of the circuit. The Arduino board is employed for generating the input to the circuit (via a digital output) and for reading the output of the circuit (via an analog input). The Arduino board also communicates the recorded data to Simulink for visualization and analysis.

Equipment: Arduino board, breadboard, resistor, capacitor, jumper wires, ohmmeter (optional), capacitance meter (optional); for Activity 1C you will also need three potentiometers (10k, 50k, 500k), three operational amplifiers, one AA battery, and two 9V batteries

Activity 1A: Time-Response Identification of a Resistor Capacitor (RC) Circuit

Topics covered: modeling electrical systems, first-order systems, system identification

The purpose of this activity is to demonstrate how to model a simple electrical system. Specifically, a first principles approach based on the underlying physics of the circuit and a blackbox approach based on recorded data are employed. The associated experiment is employed to demonstrate the blackbox approach, as well as to demonstrate the accuracy of the resulting models. This activity also provides a physical example of the common class of first-order systems.

Activity 1B: Frequency-Response Identification of a Resistor Capacitor (RC) Circuit

Topics covered: modeling electrical systems, first-order systems, system identification, frequency response, bode plots

In the previous activity we examined the time response of an RC circuit. The purpose of this activity is rather to understand the frequency response of the same circuit. Specifically, we experimentally construct the magnitude plot portion of the Bode plot for the RC circuit.

Activity 1C: Control of a Resistor Capacitor (RC) Circuit

Topics covered: model-based design, root locus, PI control, steady-state error, analog control

In this activity we learn how to implement a controller in order to modify a system's dynamic response. In particular, we employ a system's root locus to help tune a feedback controller in the presence of uncertainties in the model. This activity also demonstrates how to implement a control law using analog electronics.

LRC Circuit

Overview: These activities continue to explore the modeling and analysis of electrical circuits that was begun in Activity 1. Specifically, an inductor is added to the circuits. The Arduino board is still employed for reading the circuit's output and for communicating the data to the host computer, but now the input to the circuit is supplied by a battery via a pushbutton switch (or a transistor).

Equipment: Arduino board, breadboard, inductor, resistors, capacitors, jumper wires, switch (pushbutton), AA battery, transistor (optional), operational amplifier (optional), ohmmeter (optional), capacitance meter (optional)

Activity 2A: Time Response of an Inductor Resistor Capacitor (LRC) Circuit

Topics covered: modeling electrical systems, underdamped second-order systems, system identification

The purpose of this activity is to demonstrate how to model a simple electrical system. Specifically, a first-principles approach based on the underlying physics of the circuit is be employed. The associated experiment is employed to determine the accuracy of the resulting model and to demonstrate how the individual circuit components affect the response. This activity also provides a physical example of the common class of (underdamped) second-order systems.

Activity 2B: Electrical Circuits in Series

Topics covered: modeling electrical systems, loading, higher-order systems, filtering, isolation

The purpose of this activity is to demonstrate how to model circuits in series. In particular, the phenomenon of loading is investigated. Also, how to predict the response of higher-order systems is discussed.

Simple Pendulum

Overview: This activity employs a simple pendulum. A pendulum is an illustrative example of a mechanical system whose dynamics are periodic and nonlinear. The Arduino board is simply used to record and transmit the pendulum's angular position as indicated by a rotary potentiometer employed as a sensor.

Equipment: Arduino board, simple pendulum (slender metal bar with end weight), rotary potentiometer

Activity 3: Modeling of a Simple Pendulum

Topics covered: modeling rotational mechanical systems, nonlinear systems, underdamped second-order systems, sampling effects (aliasing, quantization), system identification

The purpose of this activity is to demonstrate how to model a rotational mechanical system. Specifically, the theory of modeling is discussed with an emphasis on which simplifying assumptions are appropriate in this case. The associated experiment is employed to demonstrate how to identify different aspects of a physical system, as well as to demonstrate the accuracy of the resulting model.

Lightbulb

Overview: In this activity we model a thermal system (a lightbulb) and implement different strategies for controlling the system's temperature using an inexpensive temperature sensor for feedback. The Arduino board is used for generating the control input to the system and for recording the system's output (its temperature). The control logic is developed in Simulink and is alternately run on the host computer or embedded on the Arduino board.

Equipment: Arduino board, lightbulb, AC solid-state relay, temperature sensor

Activity 4: Temperature Control of a Lightbulb

Topics covered: blackbox modeling, first-order systems, ON/OFF control, PI control, steady-state error, embedded control, autocode generation

The purpose of this activity is to demonstrate how to control switched systems. The lightbulb is a binary system with only two states, on or off. The lightbulb is either connected to the AC source or it is not; its intensity cannot be modulated. In this experiment, we observe the resulting "chattering" behavior of the lightbulb and investigate alternative methodologies for reducing the frequency of this chatter, or smoothing the chatter, through the use of deadbands, low-pass filters, and Pulse-Width Modulation. This activity also provides exposure to Proportional (P) control, Proportional-Integral (PI) control, and first-order systems.

Boost Converter Circuit

Overview: These activities employ a type of DC-DC converter circuit called a boost converter circuit. A boost converter circuit takes a DC voltage input (i.e. from a battery) and can be controlled to produce a higher level of DC voltage at its output. This type of circuit has many important applications. The Arduino board is used for measuring the output of the circuit (via an analog input) and for controlling the level of the circuit's output voltage (via a digital output). The control logic is developed in Simulink and is alternately run on the host computer or embedded on the Arduino board.

Equipment: Arduino board, breadboard, AA battery, inductor, resistor, capacitor, diode, transistor (MOSFET), jumper wires

Activity 5A: Time-Response Analysis of a Boost Converter Circuit

Topics covered: modeling electrical systems, time-response analysis, system identification, pulse-width modulation

The purpose of this activity is to build intuition regarding the operation of a boost converter circuit. The activity also demonstrates two techniques for modeling and analyzing a simple electrical system. The first approach models the circuit based on its underlying physics and compares the predicted time response of the circuit to data taken from a physical implementation of the circuit. The second approach models the circuit based on experimentally obtained frequency response data and can be found in Part (b) of the activity.

Activity 5B: Frequency Response Identification of a Boost Converter Circuit

Topics covered: frequency response analysis, system identification, nonlinear systems, pulse-width modulation, bode plots

In this part of the activity we model the boost converter circuit based on experimentally obtained frequency response data. This technique provides intuition regarding frequency response analysis and demonstrates a blackbox approach for generating an approximate (local) model of a nonlinear system.

Activity 5C: Feedback Control of a Boost Converter Circuit

Topics covered: frequency response analysis, system identification, lead compensation, embedded control, autocode generation

The purpose of this activity is to demonstrate how to design a controller using frequency response techniques based on an empirically derived, and imperfect, plant model. Furthermore, this activity demonstrates how embedded controllers are often designed and implemented in practice using modern design and code generation tools.

DC Motor

Overview: These activities employ a simple DC motor which is a common and important type of actuator found in many industrial applications and consumer products. In particular, the motor is modeled, analyzed, and controlled to achieve a desired speed response. The motor's speed is estimated from the output of a quadrature encoder which is read via two digital inputs of the Arduino board. The motor's speed is controlled using pulse-width modulation via one of the board's digital outputs. The logic for estimating the motor's speed based on encoder counts and the logic for controlling the motor's speed is developed in Simulink. Initially this logic is run on the host computer, but subsequently all of the logic is downloaded to the Arduino board.

Equipment: Arduino board, breadboard, DC motor with quadrature encoder, battery (ex: lantern battery), diode, transistor (MOSFET), jumper wires

Activity 6A: Time-Reponse Analysis of a DC Motor

Topics covered: modeling electromechanical systems, time-response analysis, system identification, reduced-order models, pulse-width modulation, filtering

The purpose of this activity is to build intuition regarding the operation of an armature-controlled DC motor. The activity also generates a blackbox model for the motor based on its step response. This type of model is compared to a physics-based model. The need and effects of filtering are also explored.

Activity 6B: PI Speed Control of a DC Motor

Topics covered: pulse-width modulation, PI control, pole placement, steady-state error, disturbance rejection, saturation, integrator wind-up, embedded control

The purpose of this activity is to build intuition regarding the design and implementation of a PI controller for the speed control of a DC motor in the presence of an array of real-world complications. Specifically, we consider how to design the controller when we have an uncertain plant model and are limited in the amount of control effort we can supply. Furthermore, we analyze our system's performance in the presence of unwanted exogenous inputs, which in this case is a constant load disturbance.


Published with MATLAB® 8.2

Control Tutorials for MATLAB and Simulink (2024)

FAQs

How to use control system in MATLAB? ›

Build models that represent your control system using model objects. Collect MIMO data, estimate and compare models, and view corresponding model responses. Perform online parameter estimation for a time-varying ARX model at the MATLAB command line. Estimate multiple parameters of a model by iterated estimations.

Where can I learn MATLAB Simulink? ›

  • MathWorks. Robotics Education - MATLAB and Simulink Robotics Arena. ...
  • MathWorks. Mechatronics with MATLAB and Simulink. ...
  • MathWorks. Simulink Onramp. ...
  • MATLAB/Simulink for the Absolute Beginner. 1894 ratings at Udemy. ...
  • Learn MATLAB and SIMULINK in one week. 555 ratings at Udemy. ...
  • IIT Roorkee; NPTEL. ...
  • Steve Brunton. ...
  • MathWorks.

How to simulate control system in MATLAB? ›

The first step is to define the system that you want to simulate. You need to specify the system parameters, such as the transfer function, the state-space model, the input and output variables, and the initial conditions. You can use MATLAB commands or graphical tools to define the system.

What is control model in Simulink? ›

Simulink Control Design lets you design and analyze control systems modeled in Simulink. You can automatically tune arbitrary SISO and MIMO control architectures, including PID controllers. PID autotuning can be deployed to embedded software for automatically computing PID gains in real time.

What is Simulink used for in MATLAB? ›

Simulink is the platform for Model-Based Design that supports system-level design, simulation, automatic code generation, and continuous test and verification of embedded systems. Key capabilities include: A graphical editor for modeling all components of a system.

What is the control system toolbox in MATLAB? ›

Control System Toolbox™ provides algorithms and apps for systematically analyzing, designing, and tuning linear control systems. You can specify your system as a transfer function, state-space, zero-pole-gain, or frequency-response model.

Why use Simulink instead of MATLAB? ›

Another factor to consider when choosing between Simulink blocks and MATLAB code is the speed and efficiency of your system. Simulink blocks can be faster and more efficient for some tasks, such as prototyping, testing, and debugging.

How long does it take to learn MATLAB Simulink? ›

If you're a novice programmer, you can expect it to take a little longer than if you were a more seasoned programmer. Someone who can afford to devote all their time to MATLAB can finish learning the language in two weeks. If you have a lot of other responsibilities, however, it will take you longer to complete.

Do I need to know MATLAB for Simulink? ›

Simulink is for MATLAB Users

Use MATLAB and Simulink together to combine the power of textual and graphical programming in one environment. Apply your MATLAB knowledge to: Optimize parameters. Create new blocks.

How to design a controller in MATLAB Simulink? ›

To design a controller, first select the controller sample time and horizons, and specify any required constraints. For more information, see Choose Sample Time and Horizons and Specify Constraints. You can then adjust the controller weights to achieve your desired performance. See Tune Weights for more information.

Does MATLAB have a circuit simulator? ›

Simulate Model and Analyze Results

In the model window, select Simulation > Run to run the simulation. To view the triangle wave in the Scope window, double-click the Scope block. You can do this before or after you run the simulation. This plot shows the voltage waveform.

How do you control output in MATLAB? ›

When paging is enabled, MATLAB displays output one page at a time.
  1. To advance to the next page of output, press the Space key.
  2. To advance to the next line of output, press the Return key.
  3. To stop displaying the current output, press the Q key. Do not use Ctrl+C to exit more , otherwise MATLAB can return an error.

How to understand Simulink model? ›

In the MATLAB Command Window, enter the model function, then list blocks with states. The Simulink debugger displays the value of a state at each time step during a simulation, and the states function for the Simulink debugger displays information about the current states (see Debug Simulations Programmatically).

How to combine two Simulink in MATLAB? ›

You can merge the changes between the two Simulink models by clicking the Merge Mode button in the toolstrip. This creates a third file, targetFile , which can contain the changes from either the left model ( sl_aircraft1) or right model ( sl_aircraft2 ).

How to model using Simulink? ›

Constructing the Simulink model. . First, open Simulink and open a new model window. Then drag two Sum blocks (from the Math Operations library) into your model window and place them approximately as shown in the figure below.

What is the command for controllability in MATLAB? ›

Co = ctrb( A , B ) returns the controllability matrix Co using the state matrix A and input-to-state matrix B . The system is controllable if Co has full rank, that is, the rank of Co is equal to the number of states.

How to use source control in MATLAB? ›

To set up a project with source control, use any of these workflows:
  1. Create a new project from an existing repository.
  2. Add an existing project to source control.
  3. Create a new project in a folder already under source control.
  4. Create a new GitHub® repository for a new or an existing project.

How does a control system work? ›

A control system is a set of mechanical or electronic devices that regulates other devices or systems by way of control loops. Typically, control systems are computerized. Control systems are a central part of production and distribution in many industries. Automation technology plays a big role in these systems.

How to design a controller in MATLAB? ›

To design a controller, first select the controller sample time and horizons, and specify any required constraints. For more information, see Choose Sample Time and Horizons and Specify Constraints. You can then adjust the controller weights to achieve your desired performance. See Tune Weights for more information.

References

Top Articles
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated:

Views: 5451

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.