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

How do I find answers in MATLAB? ›

To view all of your solutions, go to a Problem page and click View my solutions. You can view your solutions in a list or in the Solution Map. If using the list view, you can review the display by selecting a Sort by option.

Is MATLAB Simulink hard to learn? ›

MATLAB is designed for the way you think and the work you do, so learning is accessible whether you are a novice or an expert. The Help Center is always available to guide you with robust documentation, community answers, and how-to videos. Additionally, online interactive training is a great way to get started.

How much time is required to learn MATLAB? ›

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.

How to pass structure to Simulink? ›

To connect the structure input or output in a MATLAB function with Simulink, you must define a Simulink. Bus object in the base workspace. Then use this bus object as signal datra type for the signals which are to be connected to Matlab function.

How do you get a long answer in MATLAB? ›

To format the way numbers display, do one of the following:
  1. On the Home tab, in the Environment section, click Preferences. Select MATLAB > Command Window, and then choose a Numeric format option.
  2. Use the format function, for example: format short format short e format long.

How do I find Solver in MATLAB? ›

Description. S = solve( eqn , var ) solves the equation eqn for the variable var . If you do not specify var , the symvar function determines the variable to solve for. For example, solve(x + 1 == 2, x) solves the equation x + 1 = 2 for x.

Is MATLAB harder than Python? ›

The Difference in Technical Computing:

They are both used for the same type of work, such as numerical analysis, data visualization, and scientific computation. When it comes to syntax and readability, Python is often easier to read and understand than MATLAB.

What is the salary of MATLAB Simulink? ›

Average Annual Salary by Experience

Matlab Developer salary in India with less than 1 year of experience to 5 years ranges from ₹ 2.0 Lakhs to ₹ 9.4 Lakhs with an average annual salary of ₹ 5.6 Lakhs based on 342 latest salaries.

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.

Is MATLAB in high demand? ›

Matlab careers are actually on the rise today. It's a very popular programming language. It can be used by a developer, engineer, programmer, scientist, etc. to collect and sort out data, and develop apps, software, and sites.

Can I learn MATLAB in 1 month? ›

If you want to become an expert in Matlab then you need to mention which part of madlab you want to learn and want expertise. If I generalize my answer highly, It may take at least 3 months to learn matlab and may take maximum 3 years to become an expert.

How to run Simulink step by step? ›

In the Simulink Toolstrip, on the Simulation tab, click Step Forward to start a simulation of the model vdp . The simulation starts and pauses just after calculating the output values for the first simulation time and before stepping to the next simulation time.

How to generate code from Simulink? ›

To generate code, you must make the following changes: In the Modeling tab of the model toolstrip, click Model Settings. The Configuration Parameters dialog opens. Navigate to the Code Generation tab, select the Generate code only parameter, and click Apply.

How to check results in MATLAB? ›

View Results in Command Window

The Summary Report link provides access to the Model Advisor Command-Line Summary report. You can review additional results in the Command Window by calling the DisplayResults parameter when you run the Model Advisor.

How do you find the step response in MATLAB? ›

[ y , tOut ] = step( sys , tFinal ) computes the step response from t = 0 to the end time t = tFinal . [ y , tOut ] = step( sys , t ) returns the step response of a dynamic system model sys at the times specified in the vector t .

How do I find something in MATLAB code? ›

Search Using Find Dialog Box

The Find dialog box opens. The search begins at the current cursor position. MATLAB finds the text you specified and highlights it. MATLAB beeps when a search for Find Next reaches the end of the Command Window, or when a search for Find Previous reaches the top of the Command Window.

What is the ANS command in MATLAB? ›

ans is the variable created when an output is returned without a specified output argument. MATLAB® creates the ans variable and stores the output there. Changing or using the value of ans in a script or function is not recommended, as the value can change frequently. ans is specific to the current workspace.

Top Articles
[Last Epoch] Harbingers of Ruin cycle starts 7/9
Last Epoch Complete Crafting Guide - Odealo
Beau Is Afraid Showtimes Near Island 16 Cinema De Lux
Blackstone Launchpad Ucf
Karl Torp Height
Why Does It Say I Have 0 Followers on TikTok?
Climate change, eroding shorelines and the race to save Indigenous history - The Weather Network
Smoke Terminal Waterbury Photos
Phun.celeb
Temu Beanies
Craiglist Tulsa Ok
KMS ver. 1.2.355 – Haste & Tactical Relay
J. Foster Phillips Funeral Home Obituaries
Watch Valimai (2022) Full HD Tamil Movie Online on ZEE5
Craigslist Hutchinson Ks
Do you want to do a backbend?
Southpaws Grill Menu
Loceryl NAIL LACQUER
Reforge Update – Which Reforges Are The Best? – Hypixel Skyblock - Sirknightj
Praxis für Psychotherapie und Coaching Rhein-Neckar
Sloansmoans Bio
Staffing crisis: Restaurants struggle to find help in Orange County
Sufficient Velocity Quests
Jordan Torres Leaked
Wirrig Pavilion Seating Chart
Toernooien, drives en clubcompetities
Fastest Lovakengj Favour
How Far To Tulsa
Deerc De22 Drone Manual Pdf
Bolly2Tolly Sale
Www.cvs/Otchs/Simply
Sams Gurnee Gas Price
Kostenlose Karneval Google Slides Themen & PowerPoint Vorlage
What is a W-8BEN Form and Why Does It Matter?
Aerospace Engineering | Graduate Degrees and Requirements
Verizon Fios Internet Review: Plans, Prices And Speed 2024
Trailmaster Fahrwerk - nivatechnik.de
On-Campus Student Employment
Amarillos (FRIED SWEET PLANTAINS) Recipe – Taste Of Cochin
Ftbt Ugly God Lyrics
7066642123
Texas Motors Specialty Photos
Space Coast Fl Craigslist
Monte Carlo Poker Club Coin Pusher
Unveiling The "Little Princess Poppy Only Fans Leak": Discoveries And Insights Revealed
SP 800-153 Guidelines for Securing WLANs
Atlanta Farm And Garden By Owner
Se compra un casoplón por un error de Crypto.com: le dieron 10 millones en vez de 100 dólares al pedir reembolso de criptomonedas
Gwcc Salvage
What Time Does Walmart Auto Center Open
Subway Surfers Unblocked Games World
Watch It Horror Thriller movies | Crystal panel
Latest Posts
Article information

Author: Msgr. Refugio Daniel

Last Updated:

Views: 5293

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.