Control Tutorials for MATLAB and Simulink (2024)

Key MATLAB commands used in this tutorial are: tf , rlocus , feedback , step

Related Tutorial Links

  • Intro to Root Locus
  • Lead/Lag Control
  • Root Locus Activity
  • Example Animation

Related External Links

Contents

  • System model
  • System parameters
  • Performance specifications
  • Proportional control
  • Lag controller

System model

The transfer function model for the cruise control problem is given below. Please see the Cruise Control: System Modeling page for the derivation.

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

System parameters

For this example, let's assume that the parameters of the system are

(m) vehicle mass 1000 kg
(b) damping coefficient 50 N.s/m
(r) reference speed 10 m/s

and the block diagram of a typical unity feedback system is shown below.

Control Tutorials for MATLAB and Simulink (2)

Performance specifications

  • Rise time < 5 sec
  • Overshoot < 10%
  • Steady-state error < 2%

Proportional control

Recall from the Introduction: Root Locus Controller Design page, the root-locus plot shows the locations of all possible closed-loop poles when a single gain is varied from zero to infinity. Thus, only a proportional controller, Control Tutorials for MATLAB and Simulink (3), will be considered to solve this problem. The closed-loop transfer function becomes:

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

Also, from the Introduction: Root Locus Controller Design page, we know that the MATLAB command sgrid can be used to display an acceptable region of the root-locus plot. To use the sgrid, both the damping ratio, Control Tutorials for MATLAB and Simulink (5), and the natural frequency, Control Tutorials for MATLAB and Simulink (6), need to be determined first. The following two equations will be used to find the damping ratio and the natural frequency:

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

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

where

  • Control Tutorials for MATLAB and Simulink (9) = Natural Frequency [rad\s]
  • Control Tutorials for MATLAB and Simulink (10) = Damping Ratio
  • Control Tutorials for MATLAB and Simulink (11) = Rise time [s]
  • Control Tutorials for MATLAB and Simulink (12) = Maximum Overshoot

One of our design criteria is to have a rise time of less than 5 seconds. From the first equation, we see that the natural frequency must be greater than 0.36. Also using the second equation, we see that the damping ratio must be greater than 0.6, since the maximum overshoot must be less than 10%.

Now, we are ready to generate a root-locus plot and use the sgrid to find an acceptable region on the root-locus. Create a new m-file and enter the following commands.

m = 1000;b = 50;r = 10;s = tf('s');P_cruise = 1/(m*s+b);rlocus(P_cruise)axis([-0.6 0 -0.6 0.6]);sgrid(0.6, 0.36)

Control Tutorials for MATLAB and Simulink (13)

The two dotted lines in an angle indicate the locations of constant damping ratio (Control Tutorials for MATLAB and Simulink (14)=0.6); the damping ratio is greater than 0.6 in between these lines and less than 0.6 outside the lines. The semi-ellipse indicates the locations of constant natural frequency (Control Tutorials for MATLAB and Simulink (15)=0.36); the natural frequency is greater than 0.36 outside the semi-ellipse, and smaller than 0.36 inside.

We can then find a gain to place the closed-loop poles in the desired region by employing the rlocfind command. Add the code [Kp,poles]=rlocfind(P_cruise) onto the end of your m-file to help you choose a specific loop gain. After running in the command window, you should see a prompt asking you to pick a point on the root-locus plot. Since you want to pick a point in between dotted lines (Control Tutorials for MATLAB and Simulink (16)>0.6) and outside the semi-ellipse (Control Tutorials for MATLAB and Simulink (17)>0.36), click on the real axis just outside the semi-ellipse (around -0.4) as indicated by the cross mark in the following figure.

Control Tutorials for MATLAB and Simulink (18)

After doing this, you should see the following output in the MATLAB command window.

Select a point in the graphics window selected_point = -0.4002 + 0.0019i Kp = 350.2419 poles = -0.4002 

Note that the value returned from your MATLAB command window may not be exactly the same, but should at least have the same order of magnitude. This returned value can be used as the gain for the compensator and the closed-loop step response can be generated as follows.

Kp = 350.2419;sys_cl = feedback(Kp*P_cruise,1);t = 0:0.1:20;step(r*sys_cl,t)

Control Tutorials for MATLAB and Simulink (19)

With the gain Kp you just chose, the rise time and the overshoot criteria have been met; however, a steady-state error of more than 10% remains.

Lag controller

To reduce the steady-state error, a lag controller will be added to the system. The transfer function of the lag controller is:

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

The closed-loop transfer function (not including Control Tutorials for MATLAB and Simulink (21)) now becomes:

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

Finally, including the loop gain Control Tutorials for MATLAB and Simulink (23), the closed-loop transfer function becomes:

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

If you read the "Lag or Phase-Lag Compensator using Root-Locus" section in the Lead and Lag Compensator Design page, the pole and the zero of a lag controller need to be placed close together. Also, it states that the steady-state error will be reduced by a factor of Control Tutorials for MATLAB and Simulink (25). For these reasons, let Control Tutorials for MATLAB and Simulink (26) equal 0.3 and Control Tutorials for MATLAB and Simulink (27) equal 0.03.

Create a new m-file, and enter the following commands.

zo = 0.3;po = 0.03;s = tf('s');C_lag = (s+zo)/(s+po);rlocus(C_lag*P_cruise);axis([-0.6 0 -0.4 0.4])sgrid(0.6,0.36);

Control Tutorials for MATLAB and Simulink (28)

Using the rlocfind command again, we can choose a new loop gain Control Tutorials for MATLAB and Simulink (29). Enter the code [Kp,poles]=rlocfind(C_lag*P_cruise) into the command window and click on the real axis around -0.4 as shown in the following figure.

Control Tutorials for MATLAB and Simulink (30)

After doing this, you should see the following output in the MATLAB command window.

Select a point in the graphics window selected_point = -0.4002 - 0.0012i Kp = 1.2936e+03 poles = -0.9733 -0.4003 

We can then generate the new closed-loop step response as follows.

Kp = 1293.6;sys_cl = feedback(Kp*C_lag*P_cruise,1);t = 0:0.1:20;step(r*sys_cl,t)axis([0 20 0 12])

Control Tutorials for MATLAB and Simulink (31)

As you can see, the steady-state error has been reduced to near zero. The overshoot is a result of the zero added in the lag controller. For now all of the design criteria have been met and no further iterations are needed; however, you should experiment with different Control Tutorials for MATLAB and Simulink (32) and Control Tutorials for MATLAB and Simulink (33) values to see what their effect is on the closed-loop system response.


Published with MATLAB® 9.2

Control Tutorials for MATLAB and Simulink (2024)

References

Top Articles
Today's Paper - The Boston Globe
little rock cars & trucks - by owner - craigslist
NYT Mini Crossword today: puzzle answers for Tuesday, September 17 | Digital Trends
Time in Baltimore, Maryland, United States now
Craigslist Free Stuff Appleton Wisconsin
Marist Dining Hall Menu
Nation Hearing Near Me
Planets Visible Tonight Virginia
Zoebaby222
Whitley County Ky Mugshots Busted
Tokioof
735 Reeds Avenue 737 & 739 Reeds Ave., Red Bluff, CA 96080 - MLS# 20240686 | CENTURY 21
2016 Ford Fusion Belt Diagram
Rachel Griffin Bikini
Roster Resource Orioles
Walgreens San Pedro And Hildebrand
Robert Deshawn Swonger Net Worth
Melissababy
Graphic Look Inside Jeffrey Dahmer
At&T Outage Today 2022 Map
R&S Auto Lockridge Iowa
Understanding Gestalt Principles: Definition and Examples
1773x / >
Accuradio Unblocked
Top 20 scariest Roblox games
Smartfind Express Login Broward
Is Light Raid Hard
The Powers Below Drop Rate
Past Weather by Zip Code - Data Table
LG UN90 65" 4K Smart UHD TV - 65UN9000AUJ | LG CA
Dairy Queen Lobby Hours
Mosley Lane Candles
Dtlr On 87Th Cottage Grove
Nextdoor Myvidster
New York Rangers Hfboards
Regis Sectional Havertys
Tugboat Information
Labyrinth enchantment | PoE Wiki
Craigslist Tulsa Ok Farm And Garden
140000 Kilometers To Miles
2023 Fantasy Football Draft Guide: Rankings, cheat sheets and analysis
Samantha Lyne Wikipedia
Wunderground Orlando
Bob And Jeff's Monticello Fl
Conan Exiles Tiger Cub Best Food
Perc H965I With Rear Load Bracket
Arch Aplin Iii Felony
Random Animal Hybrid Generator Wheel
CrossFit 101
Sam's Club Gas Price Sioux City
Minterns German Shepherds
Besoldungstabellen | Niedersächsisches Landesamt für Bezüge und Versorgung (NLBV)
Latest Posts
Article information

Author: Arielle Torp

Last Updated:

Views: 6066

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Arielle Torp

Birthday: 1997-09-20

Address: 87313 Erdman Vista, North Dustinborough, WA 37563

Phone: +97216742823598

Job: Central Technology Officer

Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.