Control Tutorials for MATLAB and Simulink (2024)

Run Live Script Version in MATLAB Online

Contents

  • Lead or phase-lead compensator using root locus
  • Lead or phase-lead compensator using frequency response
  • Lag or phase-lag compensator using root locus
  • Lag or phase-lag compensator using frequency response
  • Lead-lag compensator using either root locus or frequency response

Lead and lag compensators are used quite extensively in control. A lead compensator can increase the stability or speed of reponse of a system; a lag compensator can reduce (but not eliminate) the steady-state error. Depending on the effect desired, one or more lead and lag compensators may be used in various combinations.

Lead, lag, and lead/lag compensators are usually designed for a system in transfer function form. The conversions page explains how to convert a state-space model into transfer function form.

Lead or phase-lead compensator using root locus

A first-order lead compensator C(s) can be designed using the root locus. A lead compensator in root locus form is given by

(1)Control Tutorials for MATLAB and Simulink (1)

where the magnitude of z0 is less than the magnitude of p0. A phase-lead compensator tends to shift the root locus toward to the left in the complex s-plane. This results in an improvement in the system's stability and an increase in its response speed.

How is this accomplished? If you recall finding the asymptotes of the root locus that lead to the zeros at infinity, the equation to determine the intersection of the asymptotes along the real axis is the following.

(2)Control Tutorials for MATLAB and Simulink (2)

When a lead compensator is added to a system, the value of this intersection will be a larger negative number than it was before. The net number of zeros and poles will be same (one zero and one pole are added), but the added pole is a larger negative number than the added zero. Thus, the result of a lead compensator is that the asymptotes' intersection is moved further to the left in the complex plane, and the entire root locus is shifted to the left as well. This tends to increase the region of stability and the system's response speed.

In MATLAB a phase-lead compensator in root locus form is implemented using the following commands (where Kc, z, and p are defined).

 s = tf('s'); C_lead = Kc*(s-z)/(s-p); 

We can interconnect this compensator C(s) with a plant P(s) using the following code.

 sys_ol = C_lead*P; 

Lead or phase-lead compensator using frequency response

A first-order phase-lead compensator can also be designed using a frequency reponse approach. A lead compensator in frequency response form is given by the following.

(3)Control Tutorials for MATLAB and Simulink (3)

Note that this is equivalent to the root locus form repeated below

(4)Control Tutorials for MATLAB and Simulink (4)

with p =1 / T, z = 1 / aT, and Kc = a. In frequency response design, the phase-lead compensator adds positive phase to the system over the frequency range 1 / aT to 1 / T. A Bode plot of a phase-lead compensator C(s) has the following form.

Control Tutorials for MATLAB and Simulink (5)

The two corner frequencies are at 1 / aT and 1 / T; note the positive phase that is added to the system between these two frequencies. Depending on the value of a, the maximum added phase can be up to 90 degrees; if you need more than 90 degrees of phase, two lead compensators in series can be employed. The maximum amount of phase is added at the center frequency, which is calculated according to the following equation.

(5)Control Tutorials for MATLAB and Simulink (6)

The equation which determines the maximum phase is given below.

(6)Control Tutorials for MATLAB and Simulink (7)

Additional positive phase increases the phase margin and thus increases the stability of the system. This type of compensator is designed by determining a from the amount of phase needed to satisfy the phase margin requirements, and determing T to place the added phase at the new gain-crossover frequency.

Another effect of the lead compensator can be seen in the magnitude plot. The lead compensator increases the gain of the system at high frequencies (the amount of this gain is equal to a). This can increase the crossover frequency, which will help to decrease the rise time and settling time of the system (but may amplify high frequency noise).

In MATLAB, a phase-lead compensator C(s) in frequency response form is implemented using the following code (where a and T are defined).

 s = tf('s'); C_lead = (1+a*T*s)/(1+T*s); 

We can then interconnect it with a plant P(s) using the following code.

 sys_ol = C_lead*P; 

Lag or phase-lag compensator using root locus

A first-order lag compensator C(s) can be designed using the root locus. A lag compensator in root locus form is given by the following.

(7)Control Tutorials for MATLAB and Simulink (8)

This has a similar form to a lead compensator, except now the magnitude of z0 is greater than the magnitude of p0 (and the additional gain Kc is omitted). A phase-lag compensator tends to shift the root locus to the right in the complex s-plane, which is undesirable. For this reason, the pole and zero of a lag compensator are often placed close together (usually near the origin) so that they do not appreciably change the transient response or stability characteristics of the system.

How does the lag controller shift the root locus to the right? Below is repeated the equation for finding where the asymptotes of the root locus intersect along the real axis.

(8)Control Tutorials for MATLAB and Simulink (9)

When a lag compensator is added to a system, the value of this intersection will be a smaller negative number than it was before. The net number of zeros and poles will be the same (one zero and one pole are added), but the added pole is a smaller negative number than the added zero. Thus, the result of a lag compensator is that the asymptotes' intersection is moved to the right in the complex plane, and the entire root locus is shifted to the right as well.

It was previously stated that a lag compensator is often designed to minimally change the transient response of system because it generally has a negative effect. If the phase-lag compensator is not supposed to change the transient response noticeably, what is it good for then? The answer is that a phase-lag compensator can improve the system's steady-state response. It works in the following manner. At high frequencies, the lag compensator will have unity gain. At low frequencies, the gain will be z0 / p0 which is greater than 1. This z0 / p0 factor will multiply the position, velocity, or acceleration constant (Kp, Kv, or Ka), and the steady-state error will thus decrease by the same factor.

In MATLAB, a phase-lag compensator C(s) in root locus form is implemented by employing the following code where it is again assumed that z and p are previously defined.

 s = tf('s'); C_lag = (s-z)/(s-p); 

We can also interconnect the compensator with a plant P(s) as follows.

 sys_ol = C_lag*P; 

Lag or phase-lag compensator using frequency response

A first-order phase-lag compensator also can be designed using a frequency response approach. A lag compensator in frequency response form is given by the following.

(9)Control Tutorials for MATLAB and Simulink (10)

The phase-lag compensator looks similar to phase-lead compensator, except that a is now less than 1. The main difference is that the lag compensator adds negative phase to the system over the specified frequency range, while a lead compensator adds positive phase over the specified frequency. A Bode plot of a phase-lag compensator has the following form.

Control Tutorials for MATLAB and Simulink (11)

The two corner frequencies are at 1 / T and 1 / aT. The main effect of the lag compensator is shown in the magnitude plot. The lag compensator adds gain at low frequencies; the magnitude of this gain is equal to a. The effect of this gain is to cause the steady-state error of the closed-loop system to be decreased by a factor of a. Because the gain of the lag compensator is unity at middle and high frequencies, the transient response and stability are generally not impacted much.

The side effect of the lag compensator is the negative phase that is added to the system between the two corner frequencies. Depending on the value a, up to -90 degrees of phase can be added. Care must be taken that the phase margin of the system with lag compensation is still satisfactory. This is generally achieved by placing the frequency of maximum phase lag, wm as calculated below, well below the new gain crossover frequency.

(10)Control Tutorials for MATLAB and Simulink (12)

In MATLAB, a phase-lag compensator C(s) in frequency response form is implemented using the following code, again assuming that a and T are defined.

 s = tf('s'); C_lag = (a*T*s+1)/(a*(T*s+1)); 

We can again interconnect the compensator with a plant P(s) as follows.

 sys_ol = C_lag*P; 

Lead-lag compensator using either root locus or frequency response

A lead-lag compensator combines the effects of a lead compensator with those of a lag compensator. The result is a system with improved transient response, stability, and steady-state error. To implement a lead-lag compensator, first design the lead compensator to achieve the desired transient response and stability, and then design a lag compensator to improve the steady-state response of the lead-compensated system.


Published with MATLAB® 9.2

Control Tutorials for MATLAB and Simulink (2024)

FAQs

Is MATLAB Simulink hard to learn? ›

Although Matlab is not considered to be a programming language, it really is easy to learn. When you write code on Matlab you actually don't care about declaring data types, allocating memories e.t.c like you do in other programming languages.

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.

Is MATLAB good for control systems? ›

As a control systems engineer, you can use MATLAB® and Simulink® at all stages of development, including plant modeling, controller design, deployment with automatic code generation, and system verification.

How can I learn MATLAB effectively? ›

Get Started with Introductory Videos

See common applications and workflows, and discover new product capabilities. Get started with MATLAB by walking through an example. This video shows you the basics, and it gives you an idea of what working in MATLAB is like.

Is MATLAB harder than Python? ›

The OOP in MATLAB is more advanced and complex, which to some can be more confusing. That being said, MATLAB is generally a more advanced language while Python is more of a beginner's language. Therefore, just because MATLAB may be more complex and confusing at first, with practice, it will become easier to grasp.

What is the salary of MATLAB Simulink engineer? ›

Matlab Simulink Developer salary in India ranges between ₹ 2.9 Lakhs to ₹ 15.0 Lakhs with an average annual salary of ₹ 5.0 Lakhs. Salary estimates are based on 47 latest salaries received from Matlab Simulink Developers.

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.

Is Simulink worth it? ›

Simulink is one of the most effective block diagram environment for modelling, simulation, and analysis of diverse systems. It is an intuitive tool that is very simple to understand.

Is MATLAB beginner friendly? ›

MATLAB is beginner-friendly and typically isn't too difficult to learn. As mentioned, MATLAB is a high-level language so the syntax is fairly straightforward and uses language very similar to standard English.

Which engineers use MATLAB the most? ›

Mechanical engineers of Design and manufacturing field use MATLAB and Simulink heavily. You would be surprised to know that MATLAB also forms the based for different CAD software as well as designing software just like SOLIDWORKS.

Is MATLAB enough for a job? ›

Conclusion. The industry has some familiar buzz that learning MATLAB will not be a good opportunity for a better career. But this is not fully true. Yes, it is an acceptable reason that salary or company structure will never be able to touch available popular jobs on other programming technologies.

Which software is better than MATLAB? ›

R, Julia, Python, and other standard programming languages might be a good fit for you, depending on your exact needs. Some other open source tools you may want to consider include: Genius Mathematic Tool, an actively developed calculator program and research tool.

What should I learn first MATLAB or Python? ›

Learning curve: Python is significantly simpler than Matlab and doesn't require as much background knowledge. Matlab is structured in a very logical and comprehensible way but is aimed at users with a deep knowledge of math.

Is MATLAB or Python better for machine learning? ›

In general, Python is preferred for larger and more complex machine learning projects due to its scalability and the availability of a wide range of libraries and frameworks. Python is also the preferred choice for deep learning due to its support for popular deep learning frameworks such as TensorFlow and PyTorch.

How difficult is MATLAB to learn? ›

MATLAB® is not hard to learn if you go for any professional course. It is ideal for engineering graduates and IT professionals willing to develop MATLAB® skills in their related fields.

Is Simulink better than 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.

Is MATLAB easy to learn for beginners? ›

MATLAB® creates an environment where issues and resolutions are expressed in familiar mathematical notation. MATLAB® is not hard to learn if you go for any professional course. It is ideal for engineering graduates and IT professionals willing to develop MATLAB® skills in their related fields.

Is MATLAB Simulink a programming language? ›

MATLAB is a high-level programming language designed for engineers and scientists that expresses matrix and array mathematics directly. You can use MATLAB for everything, from running simple interactive commands to developing large-scale applications.

References

Top Articles
Interview: Ana Ularu (Locarno and TIFF's Outbound) - IONCINEMA.com
Oregon, Washington and Alaska; Sights and Scenes for the Tourist
12 Beginner Tips for Raid: Shadow Legends
Citi Trends Watches
Barbara Roufs Measurements
Gasbuddy Joliet
Dsw Designer Shoe Warehouse Ann Arbor Photos
Royal Bazaar Farmers Market Tuckernuck Drive Richmond Va
Supreme Source Dog Food Walmart
Step 2 Score Release Thread
Salon Armandeus Nona Park
Understanding British Money: What's a Quid? A Shilling?
80 For Brady Showtimes Near Cinemark At Harlingen
Deep East Texas Farm And Garden - By Owner
Things to do in Wichita Falls on weekends 12-15 September
Wat is 7x7? De gouden regel voor uw PowerPoint-presentatie
Localhotguy
Ubreakifix Laptop Repair
How To Start Reading Usagi Yojimbo [Guide + Reading Order]
These Mowers Passed the Test and They’re Ready To Trim Your Lawn
Eliud Kipchoge Resting Heart Rate
SpaceX Polaris Dawn spacewalk - latest: 'It's gorgeous' - billionaire Jared Isaacman's awed reaction as he steps out of capsule on historic spacewalk
Isaimini 2023: Tamil Movies Download HD Hollywood
Review: 'Letters From Iwo Jima' a masterpiece - CNN.com
Perugino's Deli Menu
Busse Bladeforums
Swag Codes: The Ultimate Guide to Boosting Your Swagbucks Earnings - Ricky Spears
Merrick Rv Loans
27 Sage Street Holmdel Nj
I Wanna Dance With Somebody Showtimes Near St. Landry Cinema
Everything to know on series 3 of ITV's The Tower starring Gemma Whelan
Stuckey Furniture
Biopark Prices
Lincoln Financial Field Section 110
Americas Cardroom Promo Code For Existing Users
Ctbids Reno
Los Alamos Beach in Torremolinos: A Perfect Mediterranean Escape - Mama Málaga
Sep Latest Version
Every film that has won the Oscar for best picture
What is Landshark Beer?
Broadcastify Thurston County
Directions To Pnc Near Me
Alj Disposition Data
Swoop Amazon S3
Wis International Intranet
Restored Republic January 20 2023
Unblocked Games 67 Ez
18 Awesome Things to do in Fort Walton Beach Florida 2024 - The Wanderlust Within
Kernersville pastor arrested after police find weapons, body armor and fentanyl in his Las Vegas Hotel room
18006548818
Right Wrist Itching Superstition
H'aanit's Third Chapter | Gamer Guides: Your ultimate sou...
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5543

Rating: 4.9 / 5 (79 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.