ECE320 StudyGuide
ECE320 StudyGuide
ECE320 StudyGuide
Fall 2010 - 11
C. A. Berry
Excerpts from Dr. R. Throne’s Notes
ROSE-HULMAN INSTITUTE OF TECHNOLOGY
ECE 320 Linear Control Systems Winter 2010 - 2011
Course Information
Instructor:
Carlotta Berry (berry123)
Moench Hall, D-211
877-8657
Office hours: M-F, 2-3 hours
Description:
3R-3L-4C F,W,S Pre: ECE 300 and either ECE 230 or ME 430
Analysis of linear control systems using classical and modern control theories in both
continuous and discrete time. Plant representation, closed loop system representation, time
response, frequency response, concept of stability. Root locus, Bode, and Nyquist methods.
Computer modeling and simulation of feedback systems, implementation of discrete-time
algorithms on microcontrollers.
Text: There is no text book for this course but there are several references listed below.
There will be a study guide of lecture notes placed in the book store for purchase that will be
very helpful in mastering the course concepts.
References:
Bahram, S. and Hassul, M., Control System Design Using Matlab, Prentice Hall, 1993.
Chen, C.T., Analog and Digital Control System Design, Sanders College Publishing, 1993.
D’Azzo, J.J. and Houpis, C.H., Linear Control System Analysis and Design, McGraw-Hill, 1975.
Dorf, R.C. and Bishop, R. H., Modern Control Systems, 10th Edition, Prentice-Hall, 2010.
Friedland, B., Control System Design: An Introduction to State-Space Methods, McGraw-Hill,
1986.
Nise, N.S., Control Systems Engineering, 4th Edition, Wiley & Sons, 2004.
Ogata, K., Matlab for Control Engineers, Prentice Hall, 2008.
Ogata, K., Modern Control Engineering, Prentice-Hall, 2002.
Phillips, C.L. and Harbor, R.D., Feedback Control Systems, 3rd edition, Prentice Hall, 1996.
Qiu, L. and Zhou, K., Introduction to Feedback Control, Prentice Hall, 2010.
Rohrs, Melsa, and Schulz, Linear Control Systems, McGraw-Hill, 1993.
Analysis
Design
PID State
Integral Estimation
feedback
ECE 320 Linear Control Systems Fall 2010 - 11
Homework 1
Lectures 1-1 through 1-2
Introduction to Linear Control Systems
Models of Electrical Systems
1. An automobile driver uses a cruise control system to maintain the speed of the car at 70
miles per hour. Sketch a block diagram to illustrate this feedback system.
2. An autofocus camera will adjust the distance of the lens from the film by using a beam of
infrared or ultrasound to determine the distance to the subject. Sketch a block diagram to
illustrate this open-loop control system.
3. Classify the following systems as open-loop or closed-loop control and explain why.
a. a washing machine
b. a traffic light signal
c. garage door opener
d. a car’s twilight sentinel
4. For the following electrical circuit, find the transfer function relating the output current to
the source current. (Note: if you use Maple, you must include the screen printout)
For the above circuit, assume C = 10 F, and L = 100 mH. For the following three resistor
values, find the characteristic equation, poles, zeros, damping ratio, natural frequency,
impulse response, step response, and type of response.
a) R = 40
b) R = 50
c) R = 60
5. The following circuit represents a PID controller where V o/Vi = Kp + Kds + Ki/s,
a) derive the transfer function, Vo(s)/Vi(s) (Note: if you use Maple, you must include the
screen printout)
b) assume C1 = 0.2 F, C2 = 0.1 F, R1 = 2 M , R2 = 20 M, determine the numeric value of
the proportional gain, Kp, derivative gain, Kd, and integral gain, Ki.
6. Verify the final value theorem, by determining the steady-state value of the following
responses.
a. y(t) = e-2tu(t)
b. y(t) = sin(2t) u(t)
c. y(t) = u(t)
d. y(t) = [5 + te-2t + e-2t] u(t)
e. y(t) = [1 – e-tcos(t) – e-tsin(t)] u(t)
f. y(t) = [2 – t2e-t] u(t)
Computer Simulation
Each week there will be computer simulation problems included as part of your homework
assignment. These assignments will be completed using MATLAB, SISO Design Tool, and/or
Simulink. There is a tutorial for using MATLAB in the appendix of your study guide and there are
also several tutorials available on the internet. As part of your homework submission, you must
include the required computer printouts with a header that includes your name, assignment,
problem number and date.
7. Use the [K,p,k]=residue(num,den) command in MATLAB to find the partial-
fraction expansion for the 3 transfer functions in problem 4.
Homework 2
Lectures 1-3 through 2-2
Models of Mechanical Systems
Block Diagrams
State-Space Representation
1. The following mechanical system is initially at rest. The displacements y1 and y2 are from
their respective equilibrium positions. Assume that the input is the step force, f(t) and the
output is the displacement, y2(t). Assume that m = 0.1 kg, b = 0.4 N-s/m, k1 = 6 N/m and k2
= 4 N/m, find the transfer function, G(s) = Y2(s)/F(s).
2. The following mechanical system is initially at rest. The displacements y1 and y2 are from
their respective equilibrium positions. Assume that the input is the step force, f(t), and the
output is the displacement, y1(t). Find the transfer function G(s) = Y1(s)/F(s).
3. Find the equivalent transfer function T(s) = Y(s)/R(s) for the following system.
4. Find the equivalent transfer function T(s) = Y(s)/R(s) for the following system.
5. Derive the state-space representation for the following translational mechanical system
where x3(t) is the output. Assume that m = 1 kg, k = 1 N/m and b = 1 N-s/m.
6. Derive the state-space representation for the following electrical circuit where the input is
the voltage source, u(t) and v(t) is the output.
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
7. Convert the transfer functions in problem 1 to state space by using the following command:
[A,B,C,D] = tf2ss(num, den);
8. Convert the state space equations in problem 5 to a transfer function by using the following
command: [num, den] = ss2tf(A,B,C,D);
9. Convert the state space equations in problem 5 to zeros and poles by using the following
command: [z, p, K] = ss2zp(A,B,C,D);
10. Matlab can also be used to find the transfer function of system represented as a block
diagram and you will use this to verify your solutions to problem 3. The commands are
summarized in the following table.
(difference)
sys1 +
_
sys2
sys2
cancellation
Homework 3
Lectures 2-3 through 3-2
State equations solutions and transfer functions
Transient and Steady-State Response Analysis
̇ [ ] [ ] ( )
[ ]
3. Find the state-space representation and draw the block diagram for the system described
by the following transfer function
( )
( )
( )
4. A system has a transfer function, ( ) , determine the static gain, time constant,
6. Given the following poles plotted on the s-plane, find , n , Tp, Ts, and %OS. Assume K =
52.
6
0
-8 -6 -4 -2 0
-2
-4
-6
7. If you want to design a system with the following characteristics, plot the desired locations
of the poles on the s-plane.
a. %OS 10% and settling time less than 5s
b. %OS 10% and time to peak less than 5s
c. Time to peak less than 5 s and settling time less than 10 s
8. For the systems describe by the following transfer functions, determine the characteristic
modes, settling time and dominant pole.
a. ( )
( )( )
b. ( )
( ) ( )
c. ( )
( )( )
d. ( ) ( )( )
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
9. Verify your solutions to problems 2 and 3 by using the following MATLAB commands:
[num, den] = ss2tf(A,B,C,D); and [A,B,C,D] = tf2ss(num, den);
10. Verify your solutions to problems 4, 5, and 6 by creating the unit step response plots for the
transfer functions. You can use the [num,den]=zp2tf(Z,P,K) to get the transfer function for
problem 6. You can use the step(num,den) MATLAB commands in order to plot the
step command. You also have the flexibility of modifying the time axis by specifying the
time vector as shown in the following command, step(num, den, t).
11. Verify your solution to problem 6 by modifying the following code:
%Hwk3.m
%MATLAB Problem 6
%find rise time, peak time, %OS, settling time, damping ratio, natural %frequency of a second
order system
%You may have to modify the end time to make sure the system settles;
[y,x,t] = step(num6,den6,time);%create the step response function
% %PEAK TIME
[ymax, tp]= max(y);
peak_time = time(tp)
% %PERCENT OVERSHOOT
max_overshoot = ymax-1;
pos = max_overshoot * 100
%ZETA
z = (-log(pos/100))/(sqrt(pi^2+log(pos/100)^2))
%WN
wn = (pi/peak_time)/sqrt(1-z^2)
% %SETTLING TIME
s = length(t);
while y(s)>0.98 & y(s) <1.02;s = s-1;end;
settling_time= time(s-1)
%RISE TIME
r = 1;
while y(r)<0.1;
r = r+1;
end;
t1 = time(r-1);
r = 1;
while y(r)<0.9;
r = r+1;
end;
t2 = time(r-1);
rise_time = t2 - t1
step(tf(num,den));
Homework 4
Lectures 3-3 through 4-2
Stability Analysis – Routh-Hurwitz Criterion
1. For the following control system, use the Routh-Hurwitz criterion to determine if it is stable.
If it is unstable, state the number of poles in the RHP, LHP and on the jaxis
R(s) + 1
Y(s)
_ s(2s4 + 3s3 + 2s2 + 3s + 2)
2. Use the Routh-Hurwitz criterion to find the gain of K that will cause the following system to
be stable.
R(s) + K
Y(s)
_ (s3 + 18s2 + 77s)
3. Use the Routh-Hurwitz criterion to find the gain of K that will cause the following system to
be stable.
6. Use the Routh-Hurwitz criterion to determine if the control system described by the
following state equations is stable. If the system is unstable, state the number of poles in
the RHP, LHP and on the jaxis.
̇ [ ] [ ]
[ ]
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
7. Verify your solutions to problem 1 by using the either the pole(T) MATLAB command to
find the poles of a transfer function or the roots(C) MATLAB command to find the roots
of the characteristic equation.
8. Verify your solution to problem 6 by using eig(A) to find the eigenvalues of the A system
matrix.
9. Use the following MATLAB code to verify your solutions to problems 2 and 3.
%Hwk4b.m
%MATLAB Problem 9
%Determine the maximum value of K for system stability
10. Use the following code to plot the poles of Problems 2 and 3 on two different figures as K
increases.
%Hwk4d.m
%MATLAB Problem 10
%Create a plot of the poles of T(s) on the s-plane as K increases
K = [0:K_max2+10]; %define the range of K values to check
poles=zeros(3,length(K));
for n = 1:length(K);
den = [1 18 77 K(n)]; %define the denominator of T(s)
poles(:,n)=roots(den); %calculate the poles of T(s) for each value of K
end
plot(real(poles),imag(poles),'x');
grid;title('Poles of P3 as K increases');
xlabel('real axis');
ylabel('imaginary axis');
Homework 5
Lectures 4-3 through 5-2
Steady-State Error and Sensitivity Analysis
1. Determine the steady-state error for a unit step input, unit ramp input and unit parabolic
input for the control system described by the following transfer function.
( )
( )
2. For the following control system determine the steady-state error for the inputs: 5u(t),
5tu(t), and 5t2u(t).
3. For the control system described by the following feed forward transfer function determine
the steady-state error for the input 15t2u(t).
( )( )
( )
( )( )
4. Design the following control system by selecting a value of K such that there is a 10% steady
state error for a unit ramp input. Use the Routh-Hurwitz criterion to confirm that the system
is stable at the value of K selected.
5. Design the following unity feedback control system described by the feed forward transfer
function by selecting a value of K such that there is a 10% steady state error for a unit step
input. Use the Routh-Hurwitz criterion to confirm that the system is stable at the value of K
selected.
( )
( )
( )( )
6. The following 2 figures represent the input and output of the control system at two different
sets of controller gains (kp and ki).
controller plant
error 1
Input +_ kp + ki/s Output
R(s) (s + 1)
Y(s)
input
1.5 5
output
input
output 4.5
3.5
1
3
2.5
2
0.5
1.5
0.5
0 0
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time time
Figure A Figure B
7. For the following control system, determine the sensitivity in the closed loop transfer
function due to variations in the parameter a with a nominal value of 2.
Gc(s) Gp(s)
error s+3 10
Input +_ Output
R(s) s s2 + as + 10
Y(s)
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
8. Use the step(), lsim()and/or plot()MATLAB commands to generate the step, ramp
and parabolic responses to verify your answers to problems 1-3.
9. Use the step(), lsim()and/or plot()MATLAB commands to generate the ramp
response for the value of K selected verify your answer to problem 4.
10. Use the step(), lsim()and/or plot()MATLAB commands to generate the step
response for the value of K selected verify your answer to problem 5.
Homework 6
Lectures 5-3 through 6-2
Sensitivity Analysis and Root Locus Analysis
1. For the following control system, determine the sensitivity due to with a nominal 2. What
is the magnitude of the sensitivity function at = 1, 5, 10 rad/s?
Input s+3 10
+_ Output
R(s) s s2 + 2s + 10
Y(s)
2. For the following control system, determine the sensitivity due to with a nominal value of
1. What is the magnitude of the sensitivity function at = 1, 2, 6 rad/s?
Input Output
R(s) +_
s+2 Y(s)
3K
3. For the following control system, determine the transfer function due to the disturbance,
D(s), and the transfer function due to the input, R(s). Finally, use the Routh-Hurwitz
criterion to determine whether the system is stable.
4. For the following control system, find the steady state error due to a unit step function R(s)
and the steady state error to a unit step disturbance input D(s).
D(s)
_
Input
+ 3 + 100
Output
R(s) s+1 s + 100
_ Y(s)
2
s+2
5. For the following control system, find the steady state error due to a unit step function R(s)
and the steady state error to a unit step disturbance input D(s).
D(s)
+
Input + 1 10 +
Output
R(s) _ 2s s2 + s + 10
Y(s)
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
8. Use MATLAB to verify your answers to problems 1 and 2 by creating a plot of the magnitude
of the sensitivity function versus frequency from 0.1 to 10 rad/s. You can use the following
MATLAB commands to create the frequency response plot.
w = logspace(-1,1);%frequency range from .1 to 10 rad/s
mag,phase,w]=bode(num,den,w);%generate the Bode diagram
magdB = 20*log10(mag);%calculate the magnitude in dB
semilogx(w,mag);%plot the absolute magnitude
semilogx(w,magdB);%plot the magnitude in dB
9. Use MATLAB to verify your answers to problems 4 and 5 by calculating the steady-state
error. You can use the following MATLAB commands to find the error.
%to find steady-state error
'Step Input'
T = tf(num,den);
ess = 1 - dcgain(T)
10. Use the rlocus(num,den)MATLAB command to verify your answers to problems 6-7.
Homework 7
Lectures 6-1 through 6-2
Root Locus Analysis and Design
1. For the following control system, sketch the root locus. For what range of values of K is the
system stable?
Gc(s) Gp(s)
error s+7
Input +_ K Output
R(s) (s-1)(s+4)
Y(s)
2. For the following control system, sketch the root locus. For what range of values of K is the
system stable?
3. For the following control system, sketch the root locus. For what range of values of K is the
system stable?
4. For the following control system, sketch the root locus. For what range of values of K is the
system stable?
5. Sketch the root locus for the open loop transfer function KG(s)H(s) = ( )(
, estimate a
)
pair of complex-conjugate closed0loop poles and associated gain, K such that the peak time
is 6.283 seconds.
( )
6. Sketch the root locus for the open loop transfer function KG(s)H(s) = , estimate a
7. Sketch the root locus for the open loop transfer function KG(s)H(s) = , estimate a
pair of complex-conjugate closed-loop poles and associated gain, K such that the settling
time is 8 s.
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
8. Verify your answers to problems 1-4 using the rlocus(num,den)MATLAB command.
9. Use MATLAB to verify your answers to problems 5 – 7 by using the following code:
clear;clf;clc; %clear all variables and graphs
num=[1 1];den=[1 3 2 0]; %define the transfer function
'G(s)'
G = tf(num,den) %define the transfer function
z = 0.707; %define zeta = 0.707
wn = 1.4; %define wn = 1 rad/s
sd = 0.25; %define sd = 1 rad/s
wd = 0.25; %define wd = 1 rad/s
Kmin = 0; %minimum k value
Kmax = 3; %maximum k value
Kstep = 0.01; %k step value
rlocus(G,[Kmin:Kstep:Kmax]);%draw the root locus
hold; %hold the plot so you can add design lines
%sgrid(z,[]); %label the zeta lines on the polar plot
%sgrid([],wn); %label the wn lines on the polar plot
sgrid(z,wn); %label both zeta & wn lines on the polar plot
plot([-20 20],[wd wd],'--', [-20 20],[-wd -wd],'--'); %plot the wd line
plot([-sd -sd],[-20 20],'--'); %plot the -sd line
[K,p] = rlocfind(G); %generate gain, K, and closed loop poles p for point selected
%on the root locus
'T(s)'
%find the closed loop transfer function with the selected K
T = feedback(K*G,1)
figure; %create a new figure
%generate the closed loop step to confirm design specs
step(T);
title(['Step response, K = ', num2str(K)]);grid;
You can right click on the step response of the transfer function to display characteristics
such as peak response, settling time, rise time and steady state. You can left click to
remove the menu and hover over a point to see the value.
10. Use MATLAB to verify your answers to problems 5 – 7 by using the SISO Design Tool.
The first step is to create the transfer function in the MATLAB command window such as:
num = [1 8];den=[1 19 108 180];G = tf(num,den);
Type sisotool in the MATLAB command window to open up the SISO Design Tool
Next, import the transfer function into the SISO Design tool by clicking File->Import-
>Browse->Click on G->Import->Close->OK
To see the step response click ->Analysis->Response to Step Command. You can right click
on the step response to select desired system characteristics or design characteristics
Click View->Design Plots Configuration. Make the Plot Type None for Plot 2 and show only
the root locus on Plot 1
Click Analysis Response to Step Command and the step response window will open
You can change the loop gain by grabbing the closed loop poles or red square on the root
locus and see the changes on the step response. You can see the current value of the gain
in the current compensator section of the SISO Design Tool window. You can also change
the gain by typing directly into the compensator editor at the C = box.
You can also add design constraints to the root locus plot by right clicking to determine the
boundaries for the settling time, percent overshoot and damping ratio.
Save the figures of the step response and root locus with the required loop gain and the
design requirements overlaid for submission with your homework.
Homework 8
Lectures 7-1 through 7-3
Lag, Lead, PID Control Compensators Design, Pole and Zero Placement
1. For a control system with open loop gain KGp(s)H(s) = , design a lag compensator by
selecting values for zlag and plag such that the steady-state error for a unit ramp input is
reduced by a factor of 20.
2. For a control system with open loop gain KGp(s)H(s) = , design a lead compensator
by selecting values for zlead and plead that maintains 30% overshoot while also reducing the
settling time by a factor of 2.
3. For a control system with open loop gain KGp(s)H(s) = , design a lag-lead
controller by selecting values for zlead, plead, zlag, plag such that there is 20% overshoot, a two-
fold reduction in the settling time and a ten-fold improvement in the steady state error for a
ramp input.
4. For a control system with open loop gain KGp(s)H(s) = , design a PI controller by
selecting values for kp and ki such that the system has a 10 second settling time and a zero
steady-state error for a step input.
5. For a control system with open loop gain KGp(s)H(s) = , design a PD controller by
selecting values for kp and kd such that the system has a 2 second settling time and =
0.707.
6. For a control system with open loop gain KGp(s)H(s) = , design a PID controller by
selecting values for kp, ki and kd such that the system as a 1 second settling time and a zero
steady-state error for a step input.
7. For a control system with plant Gp(s) = , use a PID controller to place the poles at
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date. Last homework, you used SISO Design Tool in MATLAB to verify a
control systems root locus characteristics and step response. Another method to use the SISO
Design Tool is the MATLAB rltool(tf(num,den)) command. This command will open up
the root locus plot and compensator editor in SISO Design Tool. Click Analysis -> Response to
Step Command to also view the system step response as the gain on the root locus is varied.
You can right click in the step response and/or root locus plot window to add system
characteristics and design requirements.
8. Verify your answers to problem 3 by plotting the root locus and ramp response for the
uncompensated and compensated system.
9. Verify your answers to problem 6 by plotting the root locus and step response for the
uncompensated and compensated system.
10. Verify your answer to problem 7 by plotting the root locus for the uncompensated and
compensated system.
Homework 9
Lectures 8-1 through 9-1
Frequency Response Analysis and Design
1. For the control system with an open loop transfer function,
i. Use MATLAB to create the Nyquist diagram and determine the stability for K = 1
ii. Use the Nyquist diagram to determine the DC gain
iii. Use the Routh-Hurwitz criterion to determine the range of K for stability
iv. Determine the value of K, frequency, , and magnitude of the open loop transfer
function for marginal stability.
i. Use MATLAB to create the Nyquist diagram and determine the stability for K = 1
ii. Use the Nyquist diagram to determine the DC gain
iii. Use the Routh-Hurwitz criterion to determine the range of K for stability
iv. Determine the value of K, frequency, , and magnitude of the open loop transfer
function for marginal stability.
i. Use MATLAB to create the Nyquist diagram and determine the stability for K = 1
ii. Use the Nyquist diagram to determine the DC gain
iii. Use the Routh-Hurwitz criterion to determine the range of K for stability
iv. Determine the value of K, frequency, , and magnitude of the open loop transfer
function for marginal stability.
4. For the control system with the following open loop transfer function,
0
Magnitude (dB)
-5
-10
-15
-20
0
-45
Phase (deg)
-90
-135
-180
-225
-1 0 1
10 Frequency10(rad/sec) 10
8. Design the lag compensator for the control system with the following open loop transfer
function to have a static error constant Kv = 20 and at least a 50 phase margin. You can use
MATLAB to generate the necessary Bode diagram for the design. State the gain K,
compensator transfer function and include the Bode diagram [margin(sys)] and step
[step(feedback(sys))] response of the compensated system in your final
submission.
9. Design the lead compensator for the control system with the following open loop transfer
function to have a static error constant Kv = 40, 20% overshoot and a 0.1 second peak time.
You can use MATLAB to generate the necessary Bode diagram for the design. State the gain
K, compensator transfer function and include the Bode diagram [margin(sys)] and step
[step(feedback(sys,1))] response of the compensated system in your final
submission.
10. Design the lag- lead compensator for the control system with the following open loop
transfer function to have a static error constant Kv = 12 and at least a 55 phase margin.
You can use MATLAB to generate the necessary Bode diagram for the design. State the gain
K, compensator transfer function and include the Bode diagram [margin(sys)] and step
[step(feedback(sys,1))] response of the compensated system in your final
submission.
Homework 10
Lectures 9-2 through 10-2
Modern Control – State Space Design
a) ̇ [ ] [ ] [ ]
b) ̇ [ ] [ ] [ ]
c) ̇ [ ] [ ] [ ]
d) ̇ [ ] [ ] [ ]
2. A control system has the following plant transfer function, design the controller gains to
yield 5% overshoot and a peak time of 0.3 seconds. Select the third pole to cancel out the
open loop zero. Your final answer should include the controller gains and overall system
transfer function.
( )
( )
( )( )
3. Design the following control system by selecting controller gains for 20% overshoot and a 2s
settling time. Select the third pole to cancel out the open loop zero. Your final answer
should include the controller gains and overall system transfer function.
( )
( )
( )( )( )
4. Use state-feedback and integral control to have 10% overshoot, 2 s peak time and zero
steady-state error. Your final answer should include the gains and overall system transfer
function, state equations and block diagram.
̇ [ ] [ ] [ ]
5. The control system with the following plant is the same as problem 3 and it has been
designed for a 2s settling time and 20% overshoot. Design the observer to respond 10 times
faster than the closed-loop design (place the third pole at s = -200). Your final answer
should include the observer gains.
( )
( )( )( )
6. For the following control system, design the observer for the following control system to
have the desired characteristic equation. Your final answer should include the observer
gains, overall system state equations and block diagram.
( )
( )( )( ) ( )
7. For the following control system, design the integrated full-state feedback with observer to
place controller poles at {-1.8 ± j2.4} and observer poles at {-8, -8}. Your final answer should
include the observer and controller gains, overall system state equations, and block
diagram.
̇ [ ] [ ]
[ ]
8. For the following control system, design the Type 1 (integral control) integrated full-state
feedback with observer to place controller poles at {-1.8 ± j2.4} and observer poles at {-8, -
8} and the fifth pole at {-18}. Your final answer should include the integral, controller and
observer gains, overall system state equations and block diagram.
̇ [ ] [ ]
[ ]
Computer Simulation
As part of your homework submission, you must include the following computer simulations.
Include the required computer printouts with a header that includes your name, assignment,
problem number and date.
10. Use the MATLAB code “Hw10_P2.m” on the Angel course website to verify your answer to
problems 2 and 3. Plot the step response and all 3 states assuming zero initial conditions.
11. Use the MATLAB code “Hw10_P4.m” on the Angel course website to verify your answer to
problem 4. Plot the step response and all 3 states assuming zero initial conditions.
12. Use the MATLAB code “Hw10_P5.m” on the Angel course website to verify your answers
to problems 5 and 6. Plot the states, estimated states and step response of the system.
Assume that the initial condition of all actual states is 1 and all estimated states is -1.
13. Use the MATLAB code “Hw10_P7.m” on the Angel course website to verify your answers
to problem 7. Plot the states, estimated states, estimation error and step response of the
system. Assume that the initial conditions for the state variables are [1;1], state variable
error are [0.5;0.5] and estimated state variables are [0.5;0.5].
14. Write a MATLAB script file (m-file) to verify your answers to problem 8 by printing the
integral, state variable feedback and observer gains, and plotting the states, estimated
states, state error and step response. Assume that the initial conditions for the state
variables are [1;1;1], the state variable error are [-1;-1] and the estimated states variables
are [2;2].
Lecture 1-1
Introduction to Linear Control Systems
Automatic Control is essential to any field of engineering and science because it is used to
design systems and controllers such that they operate around a given set point.
Modern Control Theory is based upon the time-domain analysis of differential equation
systems such as a spring, motor and damper and the system states. Classical Control Theory is
based upon the frequency-domain analysis of a system including the transfer function and
output.
For example, a car driving straight on the road is an example of a control system. If the
objective is to keep the car driving straight on the road then the driver must make the system
stable despite potholes, wind, rain, etc. In this system, the car is the object to be controlled or
the _______________. The driver plays the role of the ________________________.
_______________________________ would occur if the driver tried to keep the car centered
with his/her eyes closed. This would not work very well and it would be difficult to stabilize the
car.
_______________________________ would occur if the driver senses the deviation in the car
position determines the proper way to turn the steering wheel to remain centered. This type of
control is also called feedback control and it is essential to most control systems.
A human controller must perform sensing, control and actuation in order to drive the car.
Sensing – observe the cars position, how far is the car from the center line?
Control – make decisions regarding what action to take, which way to turn the wheel?
Actuation – Influence the motion of the car by turning the wheel
In automatic control, machines or controllers must replace human beings to perform these
actions.
In-Class Activity:
Take one minute, select one person in class to work with and brainstorm to create a list of real
world applications of control systems.
The general structure of a feedback system is a reference signal such as the car position, the
controller which would be the human driver, the actuator or steering wheel, the plant or car
and the sensor which is also the human who determines the car’s position. An example of a
plant disturbance would be wind, rain or a pot hole. The feedback control system is modeled in
Figure 1.
Generally, a controller or compensator is selected to use the error signal (the difference
between a desired state or reference signal and the current state) to meet certain control
criteria, or specifications such as
disturbance rejection
steady-state errors
transient response characteristics
sensitivity to parameter changes in the plant
Lecture 1-2
Models of Physical Systems
The transfer function of a linear system is defined as the ratio of the Laplace transform of the
output variable to the input variable with all initial conditions assumed to be zero.
In this course, all systems are assumed to be linear which means that they obey the principle of
superposition and homogeneity. If a system is linear and the response of an input r1(t) is c1(t)
and the response of an input r2(t) is c2(t) then the response of an input k1r1(t) + k2r2(t) is k1c1(t) +
k2c2(t) for arbitrary constants, k1 and k2.
In-Class Activity 1:
For the following electrical circuit, find the transfer function relating the capacitor voltage to the
input voltage?
Vi(s) VC(s)
In-Class Activity 2:
For the above circuit, assume that L = 100 mH and C = 10 µF. For the three systems, find the
characteristic equation, poles, zeros, damping ratio, natural frequency, type of response and
plot the poles on the provided s-plane (on the next page).
System A: R = 200Ω System B: R = 250Ω
System C: R = 120Ω System D: R = 0Ω
Laplace transforms can be used to find the impulse and step response of a system. If all of the
poles of Y(s) are in the open left half plane, with the possible exception of a single pole at the
origin (s=0), then the final value theorem can be used to determine the steady-state or final
value of the response, y(t).
lim
lim
→
→
In-Class Activity 3:
Find the impulse and step response for systems A, B, C, and D. Verify that the final value
theorem holds.
In-Class Activity 4:
The following graphs represent the step response of systems A, B and C, match each figure with
the appropriate system.
Matlab Code:
sys1 = tf([1e6],[1 2000 1e6]);t = [0:.0001:.010];U=ones(size(t));lsim(sys1,U,t);axis([min(t) max(t) -.1 1.5])
sys2 = tf([1e6],[1 1200 1e6]);t = [0:.0001:.010];U=ones(size(t));lsim(sys2,U,t);axis([min(t) max(t) -.1 1.5])
sys3 = tf([1e6],[1 2500 1e6]);t = [0:.0001:.010];U=ones(size(t));lsim(sys3,U,t);axis([min(t) max(t) -.1 1.5])
sys4 = tf([1e6],[1 0 1e6]);t = [0:.0001:.010];U=ones(size(t));lsim(sys4,U,t);axis([min(t) max(t) -.1 2])
Lecture 1-3
Models of Physical Systems
Recall that the transfer function of a linear system is defined as the ratio of the Laplace
transform of the output variable to the input variable with all initial conditions assumed to be
zero. Similar to the process for deriving the mathematical model for an electrical system, it is
possible to derive the mathematical model for a mechanical system by using a free body
diagram to represent the forces acting on a mass.
In-Class Activity 1:
For the following mechanical system, f(t) is the applied force, y(t) is the displacement, M is the
mass, k is the spring constant, and b is the viscous friction. Find the transfer function relating
the force applied, f(t), to the displacement, y(t).
F(s) Y(s)
In-Class Activity 2:
For the above mechanical system, assume that M = 1 kg, b = 3 N-s/m. For the three systems,
find the characteristic equation, poles, zeros, identify the type of response and plot the poles on
the provided s-plane.
System A: k = 2 N/m
System B: k = 2.25 N/m
System C: k = 3.25 N/m
In-Class Activity 3:
Find the impulse and step response for systems A, B, and C.
There is a series and parallel analog between electrical and mechanical systems which may be
helpful in analyzing these systems. The variables of the electric circuit behave the same as the
analogous variables of the mechanical system. When compared with mesh-current equations,
the electrical circuit is a series analog. When compared to node-voltage equations, the
electrical circuit is the parallel analog. The relationship between the applied force,
displacement, mass, spring and damper and the source, node-voltage or mesh-current,
resistance, inductance and capacitance are derived.
In-Class Activity 4:
Derive the series analog relationship between the following electrical and mechanical systems.
Mechanical Electrical
Mass = m
Damper = b
Spring = k
Force = f(t)
In-Class Activity 5:
Derive the parallel analog relationship between the following electrical and mechanical systems.
Mechanical Electrical
Mass = m
Damper = b
Spring = k
Force = f(t)
Lecture 2-1
Block Diagrams
Objective: Create a block diagram from the equations that describe a control system
Derive the transfer function for a system given the block diagram
Calculate the damping ratio and natural frequency for a feedback control system
Recall that automatic control systems are represented mathematically by a set of simultaneous
differential equations. Laplace transformations reduce the problem to a set of linear algebraic
equations.
The block diagram is used to represent the transfer function or the relationship between the
input and output of the system. Table 1 presents some of the common block diagram
relationships and their equivalent representations.
Left + R(s) +
R(s) G(s) Y(s) G(s) Y(s)
Summing ± ±
Point X(s) G(s) X(s)
Y = G (R ± X)
Right + R(s) +
R(s) G(s) Y(s) G(s) Y(s)
Summing ± ±
Point 1/G(s) X(s)
Y = GR ± X X(s)
Left R(s) G(s) Y(s) R(s) G(s) Y(s)
Connection
Point R(s) 1/G(s) R(s)
Y = GR
Right R(s) G(s) Y(s)
R(s) G(s) Y(s)
Connection
Point Y(s) G(s)
Y(s)
Y = GR
In-Class Activity 1:
Derive the closed-loop transfer function for the following block diagram.
The most common block diagram in the practical control system is the closed loop transfer
function.
In-Class Activity 2:
Derive the transfer function for the following block diagram.
The open-loop transfer function is B(s)/E(s) = G(s)H(s) and the feed forward transfer function
is Y(s)/E(s) = G(s). Note that when there is unity feedback, the open-loop and feed forward
transfer functions are the same. The characteristic equation of the closed-loop transfer
function is 1 + G(s)H(s) and it describes the dynamics of the system.
The final value theorem can be used to find the gain or the static gain of the system transfer
function. If the response of the system, H(s) to a step input of amplitude A is
Y(s) = (A/s)(H(s))
The static gain, Kstatic, is found from
( ) ( ) ( )
provided H(0) exists. The steady state value of the step response is product of the static gain of
the system multiplied by the amplitude of the step input.
In-Class Activity 3:
Determine the closed loop transfer function, damping ratio, natural frequency, static gain and
type of response for the following closed loop system.
In-Class Activity 4:
Determine the closed loop transfer function for the filter represented by the following block
diagram. What type of filter is it? What is the time constant? cut off frequency? DC gain? Step
response? Steady state value?
controller plant
error 200k 1
Input +_ Output
R(s) 3 s
Y(s)
measured 3
variable 2
sensor
sys=tf([200e3],[3 300e3]);bode(sys);
Lecture 2-2
State-Space Representation
Objective: Describe the difference between modern and classical control theory
Derive the state-space representation of a plant
Create a block diagram for the state-space representation of a plant
So far in this course, we have used classical control theory concepts to derive the mathematical model of a control
system plant. Classical control theory focuses on frequency domain analysis such as deriving the transfer function
that describes the relationship between the input and output of the plant assuming zero initial conditions.
Classical control theory is used to design single-input single-output (SISO) linear time-invariant systems by using
concepts such as Bode diagrams, PID controllers, and root locus. The advantage of frequency domain techniques
is that it rapidly provides stability and transient information for design.
However, there is an alternate method for modeling a control system plant and this is based upon modern control
theory. Modern control theory focuses on time domain analysis including state-space representation, a system of
differential equations. State-space is more flexible in that it can be used on linear time-varying, multiple-input,
multiple-output systems with initial conditions.
State Space provides the minimum amount of information that must be specified in order to uniquely determine
system behavior for all time. The state of a system is a set of variables such that the knowledge of these variables
and the inputs will, with the equations describing the dynamics, provide the future state and output of the system.
The advantage of the state-variable model is that the input-output and the internal characteristics of the system
are represented. When more information about the plant is fed back, there is more complete control of the
system.
The two state equations required to model a control system plant are:
where A is the system matrix, B is the input matrix, C is the output matrix, and D is the feed forward matrix. The
state variables are the vector x, the input is the scalar or vector u, the output is the scalar or vector y, and ̇ is the
rate of change of the state variables with respect to time. The block diagram for the state representation of an
open loop plant is shown in Figure 1.
In order to describe the dynamics of a nth order system there should be n state variables and this will be
demonstrated on a mechanical and electrical system.
In-Class Activity 1:
For the following system, derive the state equations and block diagram assuming the input is f(t) and the output is
the mass position, y.
In-Class Activity 2:
For the following system, derive the state equations and block diagram assuming the input is f(t) and the output is
the mass 2 position, x2.
In-Class Activity 3:
For the following electrical network, derive the state equations and draw the block diagram that represents the
plant. Assume that the input is u(t) and the output is v o(t).
In-Class Activity 4:
For the following electrical network, derive the state equations and draw the block diagram that represents the
plant. Assume the input is u(t) and the output is vo(t).
Lecture 2-3
State Equation Solutions and Transfer functions
The solution to the state equation can be found by finding the Laplace transform of the
equation.
where I is the n x n identity matrix and x(0) are the initial conditions of the state variables
-1 -1
X(s) = (sI – A) x(0) + (sI – A) BU(s)
-1
This is the general relationship for the solution. The expression, (sI – A) , is the resolvant of A. The inverse
-1
Laplace transform of (sI – A) is the state transition or fundamental matrix.
(t) = e = L ([sI – A] )
At -1 -1
( )
( ) ( ) ∫ ( )
Note that this is the sum of the natural response due to initial conditions or energy stored in circuit elements and
the forced response due to an applied input such as u(t). Also, recall from linear algebra that the inverse of a 2 x 2
matrix can be found from the following formula
[ ] [ ]
In-Class Activity 1:
For the following electrical circuit, assume that the input is zero, R = 25 , L = 10 mH, C = 100 F, the initial voltage
across the capacitor is 1 V and the initial current through the inductor is 1 A. Solve for the natural response of x(t)
At
and the output, y(t) by using the resolvant of A or the state transition matrix, , e .
It is also possible to convert between the state space representation and the system transfer function by finding
the Laplace transform of the state equations.
-1
1) [sI – A] X(s) = BU(S) X(s) = (sI – A) BU(s)
-1 -1
Y(s) = C(sI – A) BU(s) + DU(s) Y(s) = C(sI – A) BU(s) + DU(s)
( )
( ) ( )
( )
In order to find the inverse of sI-A, you need the determinate of (sI-A). This determinate yields the denominator of
the transfer function or (s) = det(sI-A). (s) is the characteristic polynomial of the system and the roots of (s)
are the poles of the system.
In-Class Activity 4:
Assume that k = 33 N/m, b = 15 N-s/m, m = 3 kg for the following mechanical system, use the state equation
matrices to determine the transfer function.
̇ [ ] [ ]
[ ]
In-Class Activity 5:
For the following transfer function, determine the system state equations and draw the block diagram.
( )
( )
( )
In-Class Activity 6:
For the following transfer function, determine the system state equations and draw the block diagram.
( )
( )
( )
Lecture 3-1
Transient and Steady-State Response Analysis
Objective: Describe the characteristics of the transient and steady-state response of a first
and second order system
Define the terms time constant, rise time, settling time, time to peak and
percent overshoot, damping ratio, natural frequency, damped frequency
Most students have previously studied the transient and steady-state response of a system in a
circuit analysis course. These characteristics will now be examined from the perspective of
control system design.
The transient response of a system is the part that changes with time and eventually decays to
zero. The steady-state response is the part that remains after a long time. The output of a
system is the sum of the transient and steady-state response.
y(t) = yss(t) + ytran(t)
The rise time, Tr of a system is the time it takes a system’s step response to go from 0.1 to 0.9
of its final value. It can be easily verified that
Tr = ln(9)
The settling time, Ts of a system is the time it takes for the step response to reach and stay
within 2% of the final value. It can be easily verified that
Ts = - ln(.02)
Figure 1 presents an example of the rise time and setting time for a first order system.
In-Class Activity 2:
Determine the static gain, time constant, pole, rise time and settling time for the following step
response of a first-order system.
y(t) = 2(1 – e-2t) u(t)
Second-order systems
The general form of a second-order system is given by the following
( )
( )
( )
The poles of the system are
Where K is the static gain, d is the damped frequency of oscillation, n is the natural or
undamped frequency of oscillation, is the damping ratio and d is the damping factor.
There are three types of step responses dependent upon the roots of the characteristic
polynomial or poles of the system and these are shown in Table 1.
The peak time, Tp of a system is the time it takes to reach the first or maximum peak. This can
be found from
The settling time, Ts of a system is the time it takes for the step response to reach and stay
within 2% of the final value. This can be found from
The percent overshoot, %OS, is the amount that the step response overshoots the steady state
or final value. This can be found from
( )
√
( ⁄ )
√ ( ⁄ )
In-Class Activity 3:
For the following second-order system, determine the time to peak, settling time, percent
overshoot, damping ratio, damping factor, natural frequency and damped frequency.
( )
In-Class Activity 4:
For the following second-order system, determine the time to peak, settling time, percent
overshoot, damping ratio, damping factor, natural frequency and damped frequency.
( )
In-Class Activity 5:
For the following second-order system, determine the time to peak, settling time, percent
overshoot, damping ratio, damping factor, natural frequency and damped frequency.
( )
In-Class Activity 6:
For the following second-order system, determine the time to peak, settling time, percent
overshoot, damping ratio, damping factor, natural frequency and damped frequency.
( )
Lecture 3-2
Transient and Steady-State Response Analysis
Recall that the characteristics for a second-order underdamped system are described in terms
of the settling time, time to peak, damping ratio and percent overshoot given by the following
formulas.
( )
( ⁄ )
√
√ ( ⁄ )
It is possible to select the location of poles on the s-plane to satisfy design criteria based upon
these characteristics. Figure 1 presents a typical pole plot for a second-order underdamped
system.
√ √( ) ( √ )
Some key relationships between the characteristics and poles of the second-order
underdamped system include:
The peak time Tp is inversely proportional to the imaginary part of the pole
The settling time Ts is inversely proportional to the real part of the pole
The radial lines in the s-plane are constant or %OS
The following figure illustrates the desired pole locations on the s-plane to meet certain design
specifications.
In-Class Activity 1:
Given the following poles plotted on the s-plane, find , n , Tp, Ts, and %OS.
In-Class Activity 2:
If you want to design a system with Ts 9 s, %OS 10%, plot the desired locations of the poles
on the s-plane.
In-Class Activity 3:
If you want to design a system with Tp 4 s, %OS 20%, plot the desired locations of the poles
on the s-plane.
( )
( )
( ) ( )( )( )( )
The characteristic modes are the forms of the step response solution, in this case
The overall settling time of the system is determined by the characteristic mode with the
longest settling time. The dominant pole provides the longest settling time.
In-Class Activity 4:
For the following system, determine the characteristic modes, settling time and dominant pole.
( )
( ) ( )
In-Class Activity 5:
For the following system, determine the characteristic modes, settling time and dominant pole.
( )
( )( )
In-Class Activity 6:
For the following system, determine the characteristic modes, settling time and dominant pole.
( )
( )( )
Lecture 3-3
Stability Analysis – Routh-Hurwitz Criterion
Objective: Define the terms: stable, unstable and marginally stable system
Create a Routh Table to determine the stability of a closed loop system
Apply the Routh-Hurwitz criterion to determine if a system is stable
Stability is extremely important for control system design. A feedback control system cannot
be designed to regulate to a set value or track a set point without stability. BIBO stability
means that for every bounded input to a system, the output remains bounded with increasing
time.
A system is stable if all of its characteristic modes go to zero as t .
A system is marginally stable if all of its characteristic modes are bounded as t .
A system is unstable if any of its characteristic modes is unbounded as t .
In other words, all of the poles of the transfer function must be in the open left half plane
(OLHP) or have negative real parts in order for the system to be stable.
In-Class Activity 1:
Determine whether the following systems are stable, unstable or marginally stable.
a) h(t) = [1 + e-t]u(t)
g) ( )
h) ( ) ( )( )
i) ( )
The Routh-Hurwitz criterion is used to determine the stability for a closed loop system and is
based upon the characteristic equation of the transfer function. The first step is to create a
Routh table using the coefficients of the characteristic polynomial. Next, apply the Routh
criterion by determining the number of sign changes in the first column of the table. The
number of sign changes represents the number of poles of the transfer function or roots of the
characteristic equation in the right half plane (RHP) of the s-plane. There are 3 different
conditions for the Routh table:
No zeros in the first column
A zero in the first column but other nonzero elements in the row
A full row of zeros
The next rows are found by using the following formulas based upon the negative of the
determinant of a 2 x 2 matrix,
| | | | | |
| | | | | |
| | | | | |
If there are any missing values in the rows then zeros should be added to pad the row.
In-Class Activity 2:
Use the Routh-Hurwitz criterion to determine if the system described by the following closed
loop transfer function is stable.
( )
( )
( )
s3
s2
s1
s0
In-Class Activity 3:
Use the Routh-Hurwitz criterion to determine if the following system is stable. If not, what
where are the poles located on the s-plane.
R(s) + 200
Y(s)
_ s4 + 6s3 + 11s2 + 6s
s4
s3
s2
s1
s0
In-Class Activity 4:
For the following system, use the Routh-Hurwitz criterion to determine the range of values of K
in order for the system to be stable. Assume that K > 0.
R(s) + K
Y(s)
_ s(s2 + s + 1)(s+2)
s4
s3
s2
s1
s0
In-Class Activity 5:
Use the Routh-Hurwitz criterion to determine if the system described by the following state
equations is stable.
̇ [ ] [ ]
[ ]
s3
s2
s1
s0
Lecture 4-2
Stability Analysis – Routh-Hurwitz Criterion
Objective: Identify the location of the poles of a system based upon the Routh-Hurwitz
Criterion
Apply the Routh-Hurwitz criterion for the special cases of a zero in the first
column and a row of zeros
Use the Routh-Hurwitz criterion to find the factors of a characteristic polynomial
Special Case 1:
Sometimes a zero occurs in the first column, In order to handle this situation, replace the zero
with a small number () and at the end let 0 and then check the sign changes in the first
column to determine the number of poles in the RHP. An alternate approach to solving this
type of situation is to apply the Routh-Hurwitz criterion to a polynomial that has the reciprocal
roots of (s). This polynomial should have the roots distributed to the same RHP, LHP and
imaginary axis.
s5
s4
s3
s2
s1
s0
s4
s3
s2
s1
s0
Special Case 2:
A row of zeros in a Routh table indicates that a purely even polynomial is a factor of the
characteristic polynomial. An even polynomial has roots that are either
Symmetrical and real,
Symmetrical and purely imaginary, or
Symmetrical and complex
The row before the zeros contains the even polynomial that is the factor of the characteristic
equation. Everything from the row containing the even polynomial down to the end of the
Routh table is a test of the roots of this polynomial. This polynomial is the auxiliary polynomial
and it is necessary to take the derivative of the auxiliary polynomial and use the coefficients to
replace the row of zeros to finish the analysis.
In-Class Activity 3:
Use the Routh-Hurwitz criterion to determine if a system with the following characteristic
equation is stable.
(s) = s3 + s2 + 2s + 2
s3
s2
s1
s0
In-Class Activity 4:
Use the Routh-Hurwitz criterion to determine if the system described by the following closed-
loop transfer function is stable.
( )
s4
s3
s2
s1
s0
In-Class Activity 5:
Use the Routh-Hurwitz criterion to determine if the system described by the following closed-
loop transfer function is stable.
( )
s4
s3
s2
s1
s0
In-Class Activity 6:
Use the Routh-Hurwitz criterion to determine the range of K for the system described by the
following state equations to be stable.
̇ [ ] [ ] [ ]
s3
s2
s1
s0
Special Notes:
1. If any coefficient ai of the characteristic polynomial is equal to zero then not all the roots
are in the LHP
2. If any coefficient ai of the characteristic polynomial is negative then at least one root is
in the RHP
Lecture 4-3
Steady-State Error
The design of a feedback control system focuses on are several ideal characteristics including:
Stability
Transient response
Steady-State accuracy
Reduced sensitivity to parameter variations and
Disturbance rejection
Recall that the transient characteristics were settling time, time to peak, percent overshoot and
rise time. In the last lecture, we found that Routh-Hurwitz is one technique for stability analysis
and today’s lecture focuses on the steady-state accuracy. All of these methods assume that the
control system is stable otherwise the system does not reach steady-state at all.
Figure 1 is a review of the closed-loop control system with a compensator or controller, plant
and sensor. Table 1 provides some examples of each of these components.
controller plant
error
Input +_ Gc(s) Gp(s) Output
R(s) Y(s)
measured
variable
H(s)
sensor
The error off the closed-loop system is given by e(t) = r(t) – y(t).
[ ( )] [ ( ) ( )] ( )
( ) ( )
[ ( )] [ ( )] ( ) [ ( )]
[ ]
[ ( )] [ ( ) ( )] [ ( ) ( ) ( )]
( )
[ ( )] [( ) ( ( ))] *( ) ( )+
Note that the steady-state error due to the ramp will only be finite if do = no or the step input
steady-state error is zero.
[ ]
[ ( )] [ ( ) ( )] [ ( ) ( ) ( )]
[ ( )] [( )( ( ))]
( ) ( )
*( )( )+
Note that the steady-state error due to the parabolic input will only be finite if do = no and d1 =
n1 or the step input and ramp input steady-state errors are zero.
[ ]
In-Class Activity 1:
For the following closed loop transfer functions, T(s) determine the steady-state error for the
inputs: 2u(t), 2tu(t), 2t2u(t).
a) ( )
b) ( )
c) ( )
In-Class Activity 2:
Match the following step, ramp and parabolic responses to the transfer functions in the previous
activity.
In-Class Activity 3:
For the following closed loop transfer function, T(s)
( )
( )( )( )
a) What is the value of a to achieve a zero steady state error for a unit step input?
b) What is the value of a to achieve an ess = 0.5 for a unit step input?
c) What is the value of a and b to achieve a zero steady state error for a unit ramp input?
d) What is the value of a and b to achieve an ess = 0.5 for a unit ramp input?
e) What is the value of a, b, and c to achieve a zero steady state error for a unit parabolic
input?
f) What is the value of a, b, and c to achieve an ess = 0.5 for a unit parabolic input?
Lecture 5-1
Steady-State Error
Recall that the prior lecture focused on using the system transfer function, T(s), to determine
the steady-state error. Table 1 provides a summary of the formulas derived to find the steady-
state error for the step, ramp and parabolic input.
[ ] [ ] [ ]
Table 1: Steady-State Error using the system transfer function
Today’s lecture presents an alternate approach for determining the steady state error by using
the feed forward gain. This technique may be preferable when the plant and compensator are
known but not the full system characteristics.
System type is defined by the number of integrators or poles at the origin in the feed forward
transfer function, G(s) = Gc(s)Gp(s). A type N system has N poles at the origin in G(s). In order
to derive the steady-state error, the final value theorem will be used on the closed loop transfer
function.
[ ] [ ]
The three most common system inputs are the step, ramp and parabolic functions. This is
because in a position control system, this would represent an object with constant position,
velocity or acceleration. For example, a step input could be used to set an antenna to face a
certain direction. A ramp input could represent tracking a satellite with a constant angular
velocity. Lastly, the parabolic input represents constant acceleration such as tracking a missile.
The next section will derive the steady-state error (ess) for these three types of inputs.
Step Input
Ramp Input
Parabolic Input
Table 2 provides a summary of the relationships between the three typical inputs, steady-state
error and error constants.
1 0 ( )
2 0 0 ( )
Note that the higher the system type, the more accurate the system’s steady-state response.
Also increasing the loop gain may reduce the steady-state error although this may affect other
system characteristics.
In-Class Activity 1:
The following position control system has an proportional controller as the compensator and a
servomotor as the plant. The servo motor has a time constant of 0.1 s and can run at full speed
in 0.4s. The gain K is a variable. Determine the system type, steady state error and error
constants for a unit step, ramp and parabolic input. Select a value of K for a steady state error
of 10% due to a unit ramp input.
power amplifier servomotor
error 10
Input +_ K Output
R(s) s(0.1s + 1)
Y(s)
In-Class Activity 2:
If a position control system has a plant Gp(s) = and a PI controller Gc(s) = kp + ki/s, find the
steady-state error for a unit step, ramp and parabolic input. Select values for kp and ki for a
steady state error of 10% due to a unit parabolic input.
In-Class Activity 3:
For the following control system, determine the steady-state error for the three inputs: 5 u(t),
5tu(t) and 5t2u(t).
In-Class Activity 4:
Design the following control system by selecting a value for K so that it has a 2% steady-state
error for a unit step input. Use the Routh-Hurwitz criterion to confirm that the system is stable
at the value of K selected. What about a 20% steady-state error? What is the best steady-state
error you can achieve with K?
controller plant
error 2
Input +_ K Output
R(s) s3 + 4s2 + 5s +2
Y(s)
Lecture 5-2
Sensitivity Analysis
So far, we have learned about 3 important control system characteristics including stability,
transient and steady-state response. Another important characteristic of control systems is
sensitivity. It is integral to control system design and system matching to understand how the
system will respond to small variations in parameter values or disturbances.
System sensitivity is a function of frequency and it is important to know the system’s operating
frequency so that the affect of parameter or block variations may be minimized. Feedback can
help compensate for variations inside of a closed loop in order to be less sensitive to variations
in the plant. Feedback also reduces the effects of disturbance inputs upon system response.
System sensitivity is the ratio of the change in the system transfer function to a change in a
process transfer function (or parameter) for a small incremental change. The system sensitivity
of a parameter is defined as the ratio of the percent change in the system transfer function,
T(s) to the percentage change in the parameter from its nominal value of o.
( )
Assume ( ) ( )
Sensitivity Function:
( ) | |
In-Class Activity 1:
For the following control system, determine the sensitivity for variations in the gain, K, which
has a nominal of 1. Use the following graph of the sensitivity function to determine the
frequency where the system is most sensitive to variations in K. Find the magnitude at = 1,
1.2 and 1.5 rad/s.
Gc(s) Gp(s)
error 1
Input +_ K Output
R(s) s(s + 1)
Y(s)
0
Magnitude (dB)
-5
-10
-15
-20
90
Phase (deg)
45
0
-1 0 1
10 10 10
Frequency (rad/sec)
In-Class Activity 2:
For the following control system, determine the closed loop transfer function, T(s) as a function
of and . Determine the sensitivity of T(s) to variations in and , where the nominal value of
is 3 and the nominal value of is 1. Determine the magnitude of the two sensitivity functions
at = 1 rad/sec and determine whether the system is more sensitive to or at this frequency.
Gc(s) Gp(s)
Input
error 1
Output
R(s)
+_
2s s+
Y(s)
In-Class Activity 3:
For the following control system, determine the closed loop transfer function as a function of
and K. Determine the sensitivity of T(s) to variations in and K where K has a nominal value of
1 and has a nominal value of 5. Determine the magnitude of the two sensitivity functions at
= 1 rad/sec and determine whether the system is more sensitive to or K at this frequency.
Lastly, find the steady-state error due to a unit step input at the nominal values for and K and
the error for each with a 10 % variation (K = 0.9, = 4.5).
Input 1 Output
R(s) +_
s+ Y(s)
Lecture 5-3
Sensitivity Analysis
The second phase of sensitivity analysis identifies how a control system responds to
i. A disturbance change in a controlled variable or
ii. Additive noise in a sensor
Given the following control system, determine the sensitivity to a disturbance, D(s) and sensor
noise, N(s).
D(s)
+
+ +
Input Gc(s) Gp(s) Output
R(s) _ Y(s)
N(s)
( )
( )
( ) ( ) ( )
( ) ( ) ( )
( )
( ) ( ) ( ) ⁄( ( ) ( ))
In-Class Activity 1:
For the following control system, determine the steady state error due to a unit step input R(s)
and a unit step disturbance, D(s). Find the sensitivity of each error due to variations in
parameter, K if the nominal value of K is 1.
D(s)
+
Input + 5K + Output
R(s) _ s2 + s + 10 Y(s)
In-Class Activity 2:
For the following control system, determine the steady-state error for a unit ramp input.
Determine the sensitivity of the steady-state error due to variations in parameters, α and K. The
nominal value of α and K are 2 and 1, respectively.
Gc(s) Gp(s)
error 1
Input K Output
R(s)
+_
s(s + a)
Y(s)
In-Class Activity 3:
For the following control system, determine the sensitivity of the transfer function to the
parameter K. Next, determine the sensitivity of the steady state error to variations in the
parameter K for a unit step input. The nominal value of K is 1.
Input K (s + 7) Output
+_
R(s) s2 + 2s + 10 Y(s)
Lecture 6-1
Root Locus Analysis
Root locus is a plot of the closed loop poles of a control system on the s-plane as a parameter
such as controller gain is varied. Root locus provides a more useful measure of stability than
Routh-Hurwitz because it shows more than just a range of values for a variable gain.
Root locus provides characteristics of a control system’s natural response and can be used to
design for certain system characteristics such as percent overshoot, settling time, and peak
time. If it is not possible to vary the gain of a system to meet a desired transient response then
it will be necessary to add a compensator to the system.
The closed-loop transfer function depends heavily on the open-loop transfer function. The
poles and zeros of G(s)H(s) are the open-loop poles and zeros. The poles and zeros of T(s) are
the closed-loop poles and zeros and roots of the characteristic equation. Recall that the roots
of the characteristic equation describe the system characteristics. The closed-loop zeros are
the zeros of G(s) and the poles of H(s). If K is small, the closed loop poles are at the poles of
G(s)H(s). If K is large, the closed loop poles are at the zeros of G(s)H(s).
The characteristic equation creates a magnitude and angle criterion that can be used to create
the root locus.
1 + KG(s)H(s) = 0 KG(s)H(s) = -1
( ) ( ) ( ) , k = 0, 1, 2, …
| ( ) ( )|
The five rules to sketch the root locus are based upon the magnitude and angle criterion and
the open loop transfer function. The rules are given in Table 1.
Rule 1: The root locus is symmetric about the real axis. The curves start
Loci Branches at each of the n poles of the open loop transfer function for K = 0
and approach the m zeros of the open-loop transfer function as K
-> . Excess poles loci extend infinitely far from the origin.
Excess zeros loci extend from infinity.
Rule 2: The loci includes all points along the real axis to the left of an
Real Axis Segments odd number of poles and zeros of the open loop transfer
function because of the angle criterion.
Rule 3: As K -> , the branches of the locus become asymptotic to
Asymptotic Angles straight lines with angles
( )
= n – m = # of poles - # of zeros
Rule 4: The starting point of the asymptotes is on the real axis at
Centroid of the Asymptotes ∑ ∑
Rule 5: Loci leave the real axis at a gain K that is the maximum K in that
Breakaway and Entry points region of the real axis. Loci enter the real axis at the minimum
value of K in that region of the real axis. Based upon this fact,
the maximum or minimum value of K can be found by finding the
first derivative of the open loop transfer function.
( )
( ) ( )
( )
( ) ( ) ( ) ( )
In-Class Activity 1:
A control system has the following open loop transfer function KG(s)H(s) = )(
,sketch
( )( )
the root locus by implementing the following steps.
Rule 1: How many loci are there? __________. Mark them on the s-plane.
Rule 2: How many real axis segments are there? ________. Mark them on the s-plane.
Rule 3: If any, match each pole with a zero on the s-plane. Calculate the asymptotic angles
using
( )
∑ ∑
Draw the Centroid of the asymptote as a dot on the s-plane and draw the
asymptotic angles as dashed lines on the s-plane.
Rule 5: Find the breakaway and entry points for any poles that have not been matched to
zeros.
( ) ( ) ( ) ( )
Throw away any roots that are not on the root locus and draw the final complete
root locus on the s-plane.
Step 6: Use the Routh-Hurwitz Criterion to determine the range of K values for stability.
Mark them on the root locus plot.
In-Class Activity 2:
( )
A control system has the following open loop transfer function KG(s)H(s) = ,sketch the
root locus by implementing the following steps.
Rule 1: How many loci are there? __________. Mark them on the s-plane.
Rule 2: How many real axis segments are there? ________. Mark them on the s-plane.
Rule 3: If any, match each pole with a zero on the s-plane. Calculate the asymptotic angles
using
( )
∑ ∑
Draw the Centroid of the asymptote as a dot on the s-plane and draw the
asymptotic angles as dashed lines on the s-plane.
Rule 5: Find the breakaway and entry points for any poles that have not been matched to
zeros.
( ) ( ) ( ) ( )
Throw away any roots that are not on the root locus and draw the final complete
root locus on the s-plane.
Step 6: Use the Routh-Hurwitz Criterion to determine the range of K values for stability.
Mark them on the root locus plot.
For the following control system sketch the root locus plot. Select the maximum value of K and
related poles to design for a settling time less than 4 seconds.
Lecture 7-1
Lag and Lead Compensator Design
Objectives: Describe the advantages and disadvantages of lag and lead compensation
Select the appropriate type of compensator to satisfy given design constraints
Implement lag and lead compensation to improve the transient and steady state
response of a control system by satisfying certain design specifications
Compare the root locus, step response and ramp response for a compensated
and uncompensated system to confirm that the design constraints are satisfied
The two key branches of the study of control systems are analysis and design. Analysis is used
to identify system characteristics such as the steady-state and transient performance. Analysis
answers the question, how does it work? The design of a control system involves adding a
compensator or controller so that it meets certain steady-state and transient constraints.
Design responds to the demand, make it work.
In the prior lecture, root locus design was introduced. The open loop gain, K was used to adjust
the closed loop poles of the control system to satisfy a given settling time, damping ratio,
natural frequency or steady-state error. The gain was used to adjust the transient and steady-
state response including stability concurrently. Adjusting the gain to meet certain design
requirements is called proportional control. However, when the gain cannot be adjusted to
meet the design requirements, it is necessary to add a compensator or controller. Lead, lag
and lag-lead compensators can be used to adjust the transient and steady-state response
independently.
Lag, lead and lag-lead compensators can be implemented using active or passive networks. The
advantage of using the passive network is that it is less expensive and does not require an
additional power source for operation. However, the disadvantage is that because it is not an
ideal compensator, the steady-state error is not driven to zero. In order, for the steady-state
error to reduce to zero, the compensator must increase the system type and be an active
network. Figure 1 provides electrical configurations for the lag, lead and lead-lag
compensators.
Key Points:
The addition of a pole can reduce steady state error but the root locus moves to the
right and makes a system less stable (lag compensator)
The addition of a zero can improve the transient response and the root locus moves to
the left which makes a system more stable (lead compensator)
( ) ( ) ( ) ( )
( ) = ( ) = ( ) =
( ) ( ) ( )( )
( )( )
( )
( ) ( )
Lecture 7-1
Lag and Lead Compensator Design
High-level summary
Step 1:
Select K (proportional control) to satisfy the percent overshoot design requirement
Use the selected K to calculate the original settling time, damping frequency and steady-
state error
Step 2:
Calculate the desired closed loop poles (pd) to satisfy the settling time and/or damping
frequency specification (transient response)
Step 3:
Calculate the sum (ps) of angles from the open loop transfer function poles and zeros to
the desired closed loop pole (ps = (zeros to pd) - (poles to pd))
Using the angle criterion to calculate the angle deficiency (def) to put the closed loop
poles on the root locus, |KGp(s)H(s)|s = -pd = 180 so def = 180 + ps
Step 4:
The lead compensator must contribute this angle, -def. Select the zero, zlead to cancel
out one of the open loop poles. Then, re-calculate the angle deficiency based upon the
new ps with one of the open loop poles gone. The lead compensator must be designed
so that plead contributes this angle, -def
Step 5:
Using the magnitude criterion for the lead compensated system, calculate the
compensator gain, Klead. |KGc(s)Gp(s)H(s)|s = -pd = 1
Step 6:
Find the steady-state error for the proportional and/or lead compensated system.
Step 7:
Calculate the necessary ratio zlag/plag to yield the desired steady-state error for the lag-
lead compensated system. Let plag be a small value such as 0.1 or 0.01 and then
calculate zlag using the ratio found.
Form the complete compensator, Gc(s) = Glag(s)Glead(s)
Step 8:
Check the steady-state design by calculating the steady-state error of the compensated
system
Check the transient design by checking the root locus or the closed-loop poles of the
compensated system
For a control system with open loop gain KGp(s)H(s) = , design a lead compensator by
( )
selecting values for K, zlead and plead so that the damping frequency is 4 rad/s and = 0.707.
selecting values for zlead, plead, zlag, plag such that there is 20% overshoot, a two-fold reduction in
the settling time and a ten-fold improvement in the steady state error for a ramp input.
Lecture 7-2
PID Compensator Design
Objectives: Describe the advantages and disadvantages of PI, PD and PID compensation
Select the appropriate type of compensator to satisfy given design constraints
Implement PI, PD, or PID compensation to improve the transient and steady
state response of a control system by satisfying certain design specifications
Compare the root locus, step response and ramp response for a compensated
and uncompensated system to confirm that the design constraints are satisfied
Proportional control involves increasing the gain, K for a control system which also increases
oscillations and overshoots and eventually the system may become unstable. Derivative
control adjusts the controller output based upon the rate change of the error and can be used
to reduce oscillations and overshoot but there will be a steady state error (rate control). The
addition of integral control can be used to correct for steady state error because it is based
upon accumulated error (reset control). Another way to think about it is proportional control is
based upon the present state of the system. Integral control is based upon the past state of the
system. Derivative control is based upon the predicted future state of the system. Figure 1
provides a graphic of a wall following robot and how the different compensators change the
performance.
A PI controller is a special case of a lag compensator with a zero at -KI/KP and a pole at the
origin. Since the pole dominates, the root locus shifts to the right and improves the steady-
state error. However, the shift to the right must be minimal to insure stability. The PI
controller has the form, .
A PD controller is a special case of a lead compensator with a zero at -KP/KD and no pole. Since
the zero dominates, it shifts the root locus to the left and improves the stability and the speed
of the response; however it may exhibit high frequency noise. Sometimes a pole is added to
reduce the noise effect. The PD controller has the form, .
Ideal compensators use pure integrators and differentiators such as the PI, PD and PID
controllers and they can be implemented using an active network. The transient response is
improved with differentiation and the steady-state response is improved with integration. The
advantage of ideal compensators is that the steady-state error can be reduced to zero because
the PI and PID controller increase the system type. The disadvantage of using a PD controller is
that the single zero increases high frequency noise as the gain increases. The lead compensator
adds a pole which reduces the high frequency noise but it does not make the system more
stable. Use the PID control to improve the steady-state error and transient response
independently. The disadvantage in using a PID controller is that there is a decrease in
response speed as the steady-state error is improved. Alternately, improving the transient
response also deteriorates the steady-state error. Figure 2 provides the 3 active network
configurations.
PI PD PID
⁄
kp = C2/C1, kd = R1C2 kp = C2/C1, kd = R1C2, ki = 1/(RaC)
kp = R1/Ra, ki = 1/(RaC1)
Table 1 provides a summary of the six types of compensators and their characteristics.
lag-lead use the lag pole and zero to improve the steady state error
use the lead pole and zero to improve the transient response
the lag pole should be small and negative
use the lead pole and zero to design the point on the root locus
PI increases the system type
improves the steady state error to zero
the zero is small and negative
PD the zero puts the design point on the root locus
it can cause noise and saturation and should be implemented with a pole or
become a lead compensator to correct for the high frequency noise
PID increases the system type and independently adjusts steady-state and
transient response
Table 2 provides a comparison and contrast of the PI, PD, and PID controllers.
PI PD PID
6
1
0.5
2
Imag Axis
Imag Axis
0 0
-2
-0.5
-4
-1
-6
-8 -1.5
-2 -1.8 -1.6 -1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0 -2 -1.8 -1.6 -1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0
Real Axis Real Axis
1.2
1
1
0.8
Amplitude
Amplitude
0.6
0.5
0.4
0.2
0 0
0 5 10 15 20 25 30 0 2 4 6 8 10 12
Time (sec) Time (sec)
In-Class Activity 1:
For a control system with open loop gain KGp(s)H(s) = , design a PI controller by
selecting values for kp and ki such that the system has a transient response with = 0.707and a
zero steady-state error for a step input.
In-Class Activity 2:
For a control system with open loop gain KGp(s)H(s) = , design a PD controller by
selecting values for kp and kd such that the settling time is reduced by a factor of 2 and =
0.707.
In-Class Activity 3:
For a control system with open loop gain KGp(s)H(s) = , design a PID controller by
selecting values for kp, ki and kd such that the time to peak is reduced by a third, there is 20%
overshoot and the steady-state error for a step input is zero.
Lecture 7-3
Pole and Zero Placement
Objectives: Describe the advantages and disadvantages of designing a control system using
pole and zero placement
Use pole and/or zero placement to improve the transient and steady state
response of a control system by satisfying certain design specifications
Compare the root locus, step response and ramp response for a compensated
and uncompensated system to confirm that the design constraints are satisfied
At times, in the design of a control system it is better to place the poles and zeros of the closed
loop control system, Gc(s), to obtain certain steady-state and transient characteristics. The
following theory is used to place the desired zeros and poles. Assume the closed loop transfer
function, T(s) and plant, Gp(s) are given by
( ) ( ) ( ) ( ) ( )
( )
( ) ( ) ( ) ( ) ( ) ( ) ( )
( )
( )
( )
Using these equations, the compensator and open loop transfer function for the desired poles
and zeros is given by the following two formulas.
( ) ( ) ()
( )
( ) ( ) ( ) ( ) ( )
( )
( ) ( )
( )
The advantage in using this technique is that the poles and zeros can be placed exactly at the
desired locations. The disadvantage is the same as for most designs, it uses the plant model, if
there is any error in the plant model; the compensator may not yield the desired results.
Finally, use the relationships in Table 1 to get the desired system type number.
Type 1 a0 = b 0
Type 2 a0 = b0, a1 = b1
Type 3 a0 = b0, a1 = b1, a2 = b2
In-Class Activity 1:
For a control system with plant Gp(s) = ( , design a controller to place the poles at -3 and
)( )
In-Class Activity 2:
For a control system with plant Gp(s) = ( )
, design a controller to place the poles at -1 j
PID pole placement raises the system type by 1 and creates a closed loop system where 3
closed-loop poles can be placed. In order to design a controller using PID pole placement use
( ) ( ) ( ) ( ) ( ), where
( )
( )
( )
In-Class Activity 3:
For a control system with plant Gp(s) = (
, use a PID controller to place the poles at -1 j√
)
and -10.
In-Class Activity 4:
For a control system with plant Gp(s) = , use a PID controller to place the poles at -1 j
( )
and -1.
Lecture 8-1
Nyquist Criterion
Objectives: Explain the benefits of using frequency response analysis on a control system
Develop the Nyquist diagram given the Nyquist path using the Cauchy theorem
Apply the Nyquist criterion to determine if a system is stable
Determine the stability of a control system with open loop poles on the
imaginary axis.
Analyzing and designing control system behavior involves three methods that should be
performed to fully understand the system. These methods include
Time domain behavior involving the inverse Laplace transform
Routh-Hurwitz and root locus involving the open loop transfer function and
characteristic equation, (s)
Frequency response behavior involving the complex frequency, s = + j
The behavior of a system to incoming frequencies is as important for stability analysis and
design as the methods previously discussed. However, it can also be used for frequency-based
applications such as radios and low pass filters. The benefit of frequency analysis is that the
frequency response can be obtained from measurements on a physical system without deriving
the system transfer function. This is important because sometimes it is difficult to get an
accurate plant model or system model.
In prior courses, the sinusoidal steady-state or frequency response for a system was obtained
by using phasor analysis (s = j). The characteristics of the system were also analyzed by using
the Bode diagram, a semi-log plot of the magnitude of the transfer function in dB and the phase
in degrees versus frequency. There are approximation techniques for sketching a Bode diagram
as well as deriving a system’s transfer function from the Bode diagram. The Bode diagram can
be used to find the bandwidth, break frequencies, resonant frequency, DC or high frequency
gain of a control system. The benefit of the Bode diagram is that you can quickly see the
effects of adding a pole or zero to the system.
The Nyquist criterion is another method for stability analysis based upon the frequency
response. The benefit of the Nyquist criterion over Routh-Hurwitz or root locus is that it not
only indicates the stability but provides useful information for the design of compensators.
Recall that for a closed loop control system to be stable, the poles of the transfer function or
roots of the characteristic equation, 1 + G(s)H(s), must be in the left-half of the s-plane. Similar
to the root locus method, the open loop transfer function, G(s)H(s), can be used to determine
the stability of the closed loop system. Nyquist criterion is based upon Cauchy’s theorem of
complex variable theory for mapping contours in the complex s-plane to the G(s)H(s)-plane.
Let’s look at some examples of how to apply Cauchy’s theorem to determine system stability.
In-Class Activity 1:
Map the following s-plane Nyquist path to the Nyquist contour or diagram, F(s)-plane.
s = + j F(s) =2s + 1
s F(s)
A 1+j
B 1
C 1–j
D -j
E -1 – j
F -1
G -1 + j
H j
In-Class Activity 2:
Map the following s-plane Nyquist path to the Nyquist contour or diagram, F(s)-plane.
s = + j F(s) =
s F(s)
A 1+j
B 1
C 1–j
D -j
E -1 – j
F -1
G -1 + j
H j
******************************************************************************
Based upon these examples, the Nyquist criterion can be stated as follows:
“If a Nyquist contour in the s-plane encircles Z zeros and P poles of F(s) and does not pass
through any poles or zeros of F(s) and is in the clockwise direction along the contour, the
corresponding contour in the F(s) plane encircles the origin of the F(s) plane N = Z – P times in
the clockwise direction. Thus, in order for a closed loop system to be stable, Z must be zero
which represents the number of roots of the characteristic equation or the poles of the closed
loop transfer function.”
By making the Nyquist path enclose the entire right half plane and the imaginary axis and
testing G(s)H(s) it is possible to determine stability by counting N, the number of clockwise
encirclements of the -1 point on the Nyquist diagram. N is negative if it represents the number
Z = N + P,
Where P = # of poles of the open loop function in the right half plane, N is the number of
encirclements of the -1 point in the G(s)H(s) plane and Z is the number of zeros of the open
loop function which are also the roots of the characteristic equation of the closed loop function
that are in the right half plane.
In-Class Activity 3:
For the control system with an open loop transfer function,
G(s)H(s) = ( )
i. Use the following Nyquist path to create the Nyquist diagram and determine the stability,
ii. Use the Nyquist diagram to determine the DC gain
iii. Use the Routh-Hurwitz criterion to determine the range of K for stability,
iv. Determine the value of K, frequency, , and magnitude of the open loop transfer function
for marginal stability.
Nyquist Diagram
4
1
Imaginary Axis
-1
-2
-3
-4
-2 -1 0 1 2 3 4 5
Real Axis
If the open loop transfer function, G(s)H(s) has a pole at the origin or on the imaginary axis then
based upon Cauchy’s theorem the analysis must use the following modified Nyquist paths.
G(s)H(s) = )
( )(
ylabel('Imaginary Axis');
0
-0.5
-1
-1.5
-2
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5
Real Axis
Lecture 8-2
Gain and Phase Margin
Objectives: Define the relative stability, gain and phase margin for a control system.
Use a Nyquist diagram to determine the relative stability of a control system by
calculating the gain and phase margin
Use a Bode diagram to determine the relative stability of a control system by
calculating the gain and phase margin
At times, in the design of a control system it is better to place the poles and zeros of the closed
system to satisfy certain stability requirements based upon the gain and phase margin.
The relative stability of a control system is the closeness of the Nyquist diagram to the -1 point
in the complex plane. This point represents the point where the system is marginally stable and
there is a pole on the j axis which leads to the satisfaction of the angle and magnitude
criterion.
|G(j)H(j)| = 1 G(j)H(j) = 180
The gain margin, GM is the factor by which the open loop gain must be changed to make a
stable system marginally stable. If the magnitude of the open loop function of a stable closed-
loop system at the -180 crossover of the Nyquist diagram is , the gain margin is 1/, possibly
in dB. If there are multiple -180 crossovers, the gain margin is the smallest magnitude in dB.
The phase crossover frequency, pc, is the frequency at which the phase of G(s)H(s) is -180.
The magnitude of G(s)H(s) at pc is A(pc) = 1/GM.
The phase margin, PM is the magnitude of the minimum angle by which the Nyquist diagram
must be rotated in order to intersect the -1 point for a stable closed-loop system. The gain
crossover frequency, gc, is the frequency at which the magnitude of G(s)H(s) is one (0 dB). The
phase G(s)H(s) at gc is (gc) = PM - 180.
The phase and gain margin can be determined from the Nyquist diagram or Bode diagram.
In-Class Activity 1:
For the control system with the following open loop transfer function,
( ) ( )
( )( )( )
determine the gain crossover frequency, phase crossover frequency, gain margin and phase
margin for K = 10.
Nyquist Plot of G(s)H(s) = 10K/[(s+2)(s+4)(s+6)]
Root Locus of G(s)H(s) = 10K/[(s+2)(s+4)(s+6)]
2
10
System: sys
8 Gain: 10.1 1.5
Pole: -1.52 + 3.79i
Damping: 0.373
6 Overshoot (%): 28.3 1
Frequency (rad/sec): 4.08
System: sys
4
0.5 Gain Margin (dB): 13.6
At frequency (rad/sec): 6.63
Imaginary Axis
2 Closed Loop Stable? Yes
Imaginary Axis
0
0
-0.5
-2
-1
-4
System: sys
Phase Margin (deg): 72.7
-6 -1.5 Delay Margin (sec): 0.499
At frequency (rad/sec): 2.54
-8 Closed Loop Stable? Yes
-2
-2 -1.5 -1 -0.5 0 0.5
-10 Real Axis
-16 -14 -12 -10 -8 -6 -4 -2 0 2
Real Axis
0
Magnitude (dB)
-20
-40
-60
-80
0
Phase (deg)
-90
-180
-270
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
In-Class Activity 2:
For the control system with the following open loop transfer function, determine the gain
crossover frequency, phase crossover frequency gain margin, and phase margin for K = 7.5.
( )
( )
( )( )
Root Locus of G(s)H(s) = 10K(s+1)/[s(s+5)(0.1s+1)] Nyquist Plot of G(s)H(s) = 10K(s+1)/[s(s+5)(0.1s+1)]
15 2
1.5
10
5
0.5
Imaginary Axis
Imaginary Axis
0 0
-0.5
-5 System: sys
Phase Margin (deg): 29.5
-1 Delay Margin (sec): 0.0196
At frequency (rad/sec): 26.2
-10 Closed Loop Stable? Yes
-1.5
-2
-15 -2 -1.5 -1 -0.5 0 0.5
-12 -10 -8 -6 -4 -2 0 2
Real Axis
Real Axis
50
Magnitude (dB)
-50
-100
-45
Phase (deg)
-90
-135
-180
-2 -1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)
In-Class Activity 3:
For the control system with the following open loop transfer function, determine the gain
crossover frequency, phase crossover frequency gain margin, and phase margin for K = 1.
( )
( )
( )( )
Root Locus of G(s)H(s) = 10K(s+1)/[(s 2 + 3s + 3)(s+3) 2] Nyquist Plot of G(s)H(s) = 10K(s+1)/[(s 2 + 3s + 3)(s+3) 2]
6 0.5
System: sys
Gain: 1.07 0.4
Pole: -1.45 + 2.04i
4
Damping: 0.579 0.3
Overshoot (%): 10.7
Frequency (rad/sec): 2.5
0.2
2 System: sys
Gain Margin (dB): 23.6
0.1 At frequency (rad/sec): 4.67
Imaginary Axis
Imaginary Axis
Closed Loop Stable? Yes
0 0
-0.1
-2
-0.2
-0.3
-4
-0.4
-6 -0.5
-9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 -0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Real Axis Real Axis
-10
-20
-30
Magnitude (dB)
-40
-50
-60
-70
-80
-90
-100
0
-90
Phase (deg)
-180
-270
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
Lecture 8-3
Frequency Response Design – Lead Compensation
Objectives: Describe the benefits of using lead and lag compensation for control system
design
Apply lag and lead compensation to improve the characteristics such as steady-
state accuracy, phase and gain margin of a control system
Recall that the gain and phase margin are used to determine the relative stability of a control
system. A minimum phase system has all of the zeros and poles of the open loop transfer
function in the left half of the s-plane. For a minimum phase system, both the phase and gain
margin must be positive for the system to be stable, otherwise it is unstable. A rule of thumb
when designing a control system is that the phase margin should be between 30 and 60
degrees and the gain margin should be greater than 6 dB.
Root Locus design reshapes the transient response of the closed loop control system.
Frequency response design adjusts the transient response in terms of the stability margins, gain
crossover frequency, static error constant, bandwidth, percent overshoot, and time to peak.
For frequency response design, it is better to work with the Bode diagram versus the Nyquist
plot because it is easier to see the effects of changes in the poles and zeros.
In frequency response design, the open loop gain is adjusted to meet the steady-state accuracy
requirements. The Bode diagram is plotted using the gain and the curves are reshaped with a
compensator to meet phase and gain margins. The low frequency gain below the gain
crossover frequency indicates the steady-state behavior of the closed-loop system (lag
compensator). The medium frequency near the gain crossover frequency indicates the relative
stability (lead compensator). The lead compensator improves the transient response to meet
the phase margin (percent overshoot) and bandwidth (settling time or peak time)
requirements.
Lead compensation improves the transient response of a control system and yields a small
change in steady-state accuracy. However, it may also accentuate high-frequency noise effects.
It improves high frequency performance, speed of response and stability margins.
Figure 1 shows the Bode diagram for a lead compensator and illustrates that it is a high pass
filter with a positive phase angle. The lead compensator can be used to provide sufficient
phase lead to offset excessive phase lag. The maximum phase lead is m and can be found from
sin m = (1-)/(1+). A change in the gain will shift the magnitude characteristic of a control
system with no change in the shape of the phase characteristic.
⁄
( ) ( ) ( ) ( )
⁄( )
required %OS, then calculate,
√ √
[ ]
4. Determine the compensators required phase angle, = PM – pm + 5 (correction factor)
5. Calculate the attenuation factor, = (1 – sin )/(1 + sin )
6. Calculate the magnitude where the compensators phase angle is maximum, M = (1/)
7. Search the Bode diagram to locate the frequency, m, where the magnitude is 1/M (in dB)
8. Use the frequency, m to find the lead compensator corner frequencies, Tlead = 1/(m )
9. Set the lead compensator zero = zlead = 1/Tlead and plead = 1/(Tlead)
10. Finally, calculate the compensator gain, Kc = 1/
Original system K = 10, gain margin = Inf dB at Inf rad/s phase margin = 17.9642 degrees at 6.1685 rad/s
50
Magnitude (dB)
-50
-90
Phase (deg)
-135
-180
-1 0 1 2
10 10 10 10
Frequency (rad/sec)
Bode Diagram
Gm = Inf dB (at Inf rad/sec) , Pm = 49.8 deg (at 8.85 rad/sec)
50
Magnitude (dB)
-50
-100
-90
Phase (deg)
-135
-180
-1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)
Step Response
1.8
orginal
1.6 compensated
1.4
1.2
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7
time,s
Design the lead compensator for the control system with the following open loop transfer
function to have a static error constant Kv = 30 and 10% overshoot.
( ) ans: K = 0.6, Gc(s) = 1.5979 (s + 24.52)/(s +39.19)
( )( )
Bode Diagram
Gm = 15.1 dB (at 77.5 rad/sec) , Pm = 50.3 deg (at 26 rad/sec)
50
0
Magnitude (dB)
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
0 1 2 3 4
10 10 10 10 10
Frequency (rad/sec)
Bode Diagram
Gm = 14.8 dB (at 98.6 rad/sec) , Pm = 60.6 deg (at 31.3 rad/sec)
50
0
Magnitude (dB)
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
0 1 2 3 4
10 10 10 10 10
Frequency (rad/sec)
Step Response
1.4
orginal
compensated
1.2
0.8
0.6
0.4
0.2
0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
time,s
Lecture 9-1
Frequency Response Design – Lag-Lead Compensation
Objectives: Describe the benefits of using lag-lead compensation for control system design
Apply lag-lead compensation to improve the characteristics such as steady-state
accuracy, phase and gain margin of a control system
A lag-lead compensator is used to improve the transient and steady-state response of a control
system. The design technique involves adjusting the gain, K to satisfy the steady-state error
requirements. The next step is to use the lag compensator to maintain the steady-state
characteristics. Lastly, use the lead compensator to meet the transient characteristics such as
phase and gain margin, percent overshoot, settling time and peak time. Figure 1 shows the
Bode diagram of the lag-lead compensator and it also illustrates a band reject filter.
⁄ ⁄
( ) ( ) ( ) ( )( ) ( )( )
⁄( ) ⁄( )
0< < 1, >1
Relevant Formulas:
√( ) √
√ √
( )
Lag compensator
3. If the phase margin is not given , calculate the damping ratio, , from the %OS then
calculate the required phase margin, PM from the damping ratio,
4. If the time to peak and/or settling time are given, calculate the required natural frequency,
n from the time to peak, Tp or Ts then calculate the required bandwidth, BW from the
natural frequency, n. Let the new phase margin frequency, pm = 0.8 BW
5. If the time to peak and/or settling time are not given, let the new phase margin frequency,
pm = the uncompensated gain crossover frequency, gc. Next, let = 10, and skip to step
9.
6. Determine the uncompensated phase, at the phase margin frequency, pm
7. Calculate the required phase angle, = -(180 + ) + PM + 5 (correction factor)
8. Determine the gain, = (1 + sin )/(1 - sin )
9. Set the lag compensator zero, zlag = 0.1 pm
10. Set the lag compensator pole, plag = zlag /
Lead compensator
11. Design the lead compensator by letting = 1/
12. Set the lead compensator zero, zlead = pm
13. Set the lead compensator pole, plead = zlead /
In-Class Activity 1:
For the control system with the following open loop transfer function, design a lag-lead
compensator to have a phase margin of at least 50 degrees and a static error constant, Kv =20.
( )
( )( )( )
ans: K = 100, (s+0.51)/(s+0.00473), (s+0.491)/(s+52.97)
Bode Diagram
Gm = -9.12 dB (at 3.16 rad/sec) , Pm = -24.2 deg (at 5.1 rad/sec)
100
50
Magnitude (dB)
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
-2 -1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)
Bode Diagram
Gm = 39.5 dB (at 18 rad/sec) , Pm = 60 deg (at 0.383 rad/sec)
150
100
Magnitude (dB)
50
-50
-100
-150
-90
-135
Phase (deg)
-180
-225
-270
-4 -3 -2 -1 0 1 2 3
10 10 10 10 10 10 10 10
Frequency (rad/sec)
Step Response
orginal
1.2 compensated
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25 30 35
time,s
In-Class Activity 2:
Design a lag-lead compensator with a 15% overshoot, 1s peak time and static error constant Kp
= 20 for the control system with the following open loop transfer function
( )
( )( )( )
ans: K = 24, (s + 1.5)(s + 0.37)/[(s+9)(s+0.06)]
Bode Diagram
Gm = -3.1 dB (at 4.47 rad/sec) , Pm = -9.61 deg (at 5.26 rad/sec)
50
0
Magnitude (dB)
-50
-100
-150
0
Phase (deg)
-90
-180
-270
-2 -1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)
Bode Diagram
Gm = 13.5 dB (at 8.54 rad/sec) , Pm = 60.6 deg (at 3.26 rad/sec)
40
20
Magnitude (dB)
-20
-40
-60
-80
0
Phase (deg)
-90
-180
-270
-3 -2 -1 0 1 2
10 10 10 10 10 10
Frequency (rad/sec)
Step Response
orginal
1 compensated
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9 10
time,s
Lecture 9-2
State Space Controller Design
Objectives: Compare and contrast frequency response versus state space design
Implement controller design to place all the closed loop poles in a system
Determine the controllability of a control system
The benefit of state space design versus frequency response design is that it can be applied to a
wider class of systems. For example, it is applicable to systems with nonlinearities and
multiple-input, multiple-output systems.
The drawback of frequency response and root locus techniques is that after designing the
second order dominant pair of poles, it is not clear how a higher order pair of poles affects the
second-order approximation. State-space allows you to specify all of the closed-loop pole
locations which the frequency response does not, but this requires access to more than just the
output but also the states of the system. The drawback of state-space design is that it may be
more sensitive to parameter changes.
For state-space design, state variables (x1, x2, …) are fed back to the control, u through a gain K
instead of the output y (u = -Kx + r). The n gains can be adjusted to yield the required closed
loop poles. If there is no input, r to the system then the control system is a regulator.
̇ ( ) y = Cx
-K
⃛ ̈ ̇ ⃛ ̈ ̇
̇ [ ] [ ]
[ ]
In-Class Activity 1:
A control system has the following plant, design the controller gains to yield 9.5% overshoot and
0.74 second settling time.
( )
( )
( )( )
ans: K1 = 406.32, K2 = 131.32, K3 = 10.81
In-Class Activity 2:
Design the following control system by selecting controller gains for 20.8% overshoot and a 4s
settling time.
̇ [ ] [ ] [ ]
If an input can be found to take every state variable from a desired initial state to a desired final
state, the system is controllable; otherwise, the system is uncontrollable. A system is
controllable if the controllability matrix Cm is of full rank. A matrix that is full rank has a non-
zero determinant.
[ ]
In-Class Activity 3:
Determine if the following two systems are controllable.
a) ̇ [ ] [ ]
b) ̇ [ ] [ ]
Lecture 10-1
State Space Observer Design
An observer or estimator is used to calculate state variables that are not accessible from the
plant. Sometimes, it is expensive or not feasible to add sensors for every state in a system. A
simulator or other electronics can be used to estimate the states and the controller will receive
the estimated states instantaneously. Use the input, estimated states and output of the system
to deduce the state variables and feedback of the estimated states.
The design of an observer is separate from the design of the controller gain vector, K. The
design consists of finding the observer gains, L so that the transient response of the observer is
faster than the controlled loop to yield a rapidly updated estimate of the state vector.
̂̇ ̂ ̃ ̂ ( ̂) ̂ ( ̂)
̇ ̂̇ ̃̇ ( )̃
observer estimator state equations output equation
̇ [ ][ ]
[ ̇] [ ][ ] [ ] ̂
̂ ̂
̇ [ ][ ]
[ ̇] [ ][ ] [ ] ̃
̃ ̃
If all of the eigenvalues of A-LC are negative then the state error will go to zero. Figure 1 shows
a block diagram of a control system with an observer.
u + x 1 x y+ y + x 1
B C L x
+ s + s
_ to the
controller
A A
y
C
Observer canonical form is the easiest form for designing observer gains.
⃛ ̈ ̇ ⃛ ̈ ̇
̇ [ ] [ ] [ ]
Note that the observer canonical and controller canonical forms are duals which means that
In-Class Activity 1:
The control system with the following plant has been designed for a 4s settling time and 20.8%
overshoot. Design the observer to respond 10 times faster than the closed-loop design.
( )
( )( )( )
In-Class Activity 2:
Design the observer for the following control system to have a 0.8s settling time and 16.3%
overshoot.
̇ [ ] [ ]
[ ]
If a state vector, x(t), can be found from u(t) and y(t) over a finite time interval then a system is
observable; otherwise, the system is unobservable. A system is observable if the observability
matrix Om is of full rank. A matrix that is full rank has a non-zero determinant.
[ ]
In-Class Activity 3:
Determine if the following two systems are observable.
a) ̇ [ ] [ ] [ ]
b) ̇ [ ] [ ] [ ]
Lecture 10-2
Integral control, Integrated Full-State Estimation and Feedback
Note that the systems designed with the controller and observer gains have a significant
steady-state error. In order to reduce the steady-state error, integral control can be added to
the input to the control system. In order to implement integral control to produce zero steady-
state error, an additional state, xi must be added to the control system with a gain Ki. The
equations for the modified control system and block diagram are given in Figure 1.
1 xi + u x x
r + e
Ki B
+ 1
C y
_ s + + s
-K
̇
Integral Control ̇ = -Cx + r [ ]
̇
[ ][ ] [ ]
̇
[ ] [ ][ ] [ ]
Integral state-feedback ̇
control
[ ]
In-Class Activity 1:
Design the following state-feedback control system to have 10% overshoot and a settling time
of 0.5s by selecting the controller gains. What is the steady-state error of the designed system?
Modify the control system to include integral control and produce a zero steady-state error.
Verify that the steady-state error is indeed zero.
̇ [ ] [ ] [ ]
system step response
0.9
original
0.8
state-feedback
0.7 integral control
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
time (s)
In-Class Activity 2:
Design the following control system with state-feedback integral control to have a zero-steady-
state error, 0.707 damping ratio and a 3.14 s peak time by selecting the controller gains.
̇ [ ] [ ] [ ]
0.8
0.6
0.4
0.2
0
0 1 2 3 4 5 6 7 8 9 10
time (s)
In the prior 2 lectures, the separation method was used to design the state controller and
observer gains. These two techniques can be combined to design a compensator for integrated
full-state feedback and estimation.
̂
̇ ̂
̂̇ ( )̂ ̂ ( )̂
̃ ̂
observer estimator state equations output equation
̇ [ ][ ]
[ ̇] [ ][ ] ̂
̂ ̂
̇ [ ][ ]
[ ̇] [ ][ ] ̃
̃ ̃
Figure 2 shows the block diagram for the control system with integrated full-state feedback and
estimation.
-K
u + x 1 x y+ y + x 1
B C L x
+ s _ + s
A A
y
C
In-Class Activity 3:
For the following control system, design the integrated full-state feedback with observer to
place controller poles at {-6, -1 ± j} and observer poles at {-5 ± j5, - 1.414}.
̇ [ ] [ ] [ ]
initial condition 0.5 initial condition 0.5 initial condition 0.5
1 1 0.5
state variable, x1
state variable, x2
state variable, x3
0.5 0.5 0
0 0 -0.5
-0.5 -0.5 -1
0 5 0 5 0 5
t (sec) t (sec) t (sec)
initial condition 0.25 initial condition 0.25 initial condition 0.25
1 0.3 0.5
error state variable, e1
0 -0.1 -1
0 5 0 5 0 5
t (sec) t (sec) t (sec)
In-Class Activity 4:
For the following control system, design the integrated full-state feedback with observer to
place controller poles at {-2, -1 ± j} and observer poles at {-10 ± j2, -20}.
̇ [ ] [ ] [ ]
initial condition 0.5 initial condition 0.5 initial condition 0.5
4 3 0.6
state variable, x1
state variable, x2
state variable, x3
2 0.4
2
1 0.2
0
0 0
-2 -1 -0.2
0 5 0 5 0 5
t (sec) t (sec) t (sec)
initial condition 0.25 initial condition 0.25 response to initial condition 0.25
5 1 0.3
error state variable, e1
-10 -3 -0.1
0 5 0 5 0 5
t (sec) t (sec) t (sec)
Figure 3 shows the block diagram for the control system with integrated Type 1 full-state
feedback and estimation. The benefit of this model is that it will exhibit zero steady-state error
for a unit step input.
u=
̂̇
̃̇ ̇ ̂̇
̇
[ ̇] [ ][ ] [ ]
̂̇ ̂
̇
[ ̇] [ ][ ] [ ]
̃̇ ̃
Lab 1
Time Domain Analysis of a 1DOF Rectilinear System
Objective: Become familiar with the ECP control system and MATLAB interface
Collect experimental data from a 1DOF rectilinear system
Identify the parameters of the 1DOF system using time domain analysis
Prelab: Read this laboratory theory and procedure thoroughly. Submit your answer to
the following question on engineering paper at the beginning of the lab.
2.5
2
Amplitude
1.5
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (sec)
1.5
y, cm
0.5
-0.5
-1
-1.5
0 0.5 1 1.5 2 2.5 3
Time (sec)
Theory:
The one degree of freedom rectilinear mass-spring-damper system can be modeled by a second
order differential equation. Figure 3 shows an example of a one degree of freedom rectilinear
mass-spring-damper system.
( )
where K is the static gain, n is the natural frequency, and is the damping ratio. These are the
parameters that must be determined to match the model to your system. Figure 4 provides a
typical under-damped second order system response. You will be creating a similar plot for the
mass-spring system in lab in order to identify the system modeling parameters.
Recall that the second order equation is given by ̈ ̇ ( ). You can use this
plot and the following equations to estimate the system parameters.
Peak time
Damping frequency √
Percent overshoot
Damping ratio
( )
√
( )
Static Gain
There is an alternate method for finding the damping ratio and natural frequency of an under
damped system. The log-decrement method can be applied to the natural (initial condition)
response of a second order system in the time domain. Logarithmic decrement, δ, is the
natural log of the amplitudes of any two successive peaks:
where xo is the greater of the two amplitudes and xn is the amplitude of a peak n periods away.
The damping ratio is then found from the logarithmic decrement:
√ ( )
The damping ratio can then be used to find the natural frequency ωn.
Procedure:
A. System Setup
1. Every week you will need to start ECP 3.2->Download the Controller Personality File-
>Reset the Controller
2. Create a folder under Documents\ECE320\<your initials\Lab1
3. Download the LAB1.rar files from the Angel class folder to the directory you created in
step 1.
4. Start MATLAB and change the current directory to the one created in step 1.
5. Start SIMULINK by typing simulink in the MATLAB window
6. Follow the procedure in the “shortguide.pdf” to reset the ECP system using SIMULINK
and run the open loop model.
7. Be sure to save the ESCPDSPReset.mdl and Model210_Opennloop.mdl files after
changing the Base Address.
B. Set up the Mass-Cart-Spring system
1. Use the Allen wrenches provided in the tool box to lock all of the carts in place except
the one closest to the motor.
2. Put two 500 gram masses on the cart closest to the motor.
3. Select two springs, put the stiffer one between the cart and the motor and the other
one between the first and second cart.
4. You will need this set up for future labs so record the spring numbers, spring location,
number and type of 500g masses. It may be helpful to draw a diagram that you can
replicate later. You must provide a summary of the detailed set up in the lab memo.
Figure 7 provides an example of a detailed diagram of the system setup.
5. Be sure to also record the number of the ECP system, these sometimes get moved
around and you must use the same one every week, they are not interchangeable.
S2 5 3A1
3
f
C. Step Response
1. Open the Model210_Opennloop.mdl and change the source block to a step, change the
step time to “0” and the final value to “0.1” (0.1 cm). You should run the simulation
until the system reaches steady state so select a reasonable value for the simulation
stop time between 1 and 5 seconds. The simulation stop time is located in the main
simulink window at the top next to the compile button.
2. Compile, connect and run Model210_Opennloop.mdl. In order to avoid compiling the
open loop model every time you change the step amplitude or simulation time, you can
make them both variables such as amp or simtime in the simulink block diagram and
vary them in the MATLAB command window.
3. The simulation will create a graph of the step response and save the data to the time
and x1 variables on the MATLAB workspace. You should use these variables to create a
plot of the step response (plot(time,x1). Make sure to turn on the grid and put a
descriptive label and title. You will estimate the system parameters from this graph.
This plot and the estimated parameters should be included in your lab memo.
4. Note that these computers are old and the data acquisition may be faster than it can
handle and you will get an error pop up that states too fast for hardware. Simply ignore
this error and continue to work. However, if MATLAB starts to crash from these errors,
you should increase the sample time in the Model210_Opennloop.mdl to
approximately 0.004 in the ECP DAC yellow model block.
5. Repeat steps 1 through 4 for four masses on the cart. Don’t forget to record the mass
numbers used for inclusion in your memo and so that you can set the system up again in
the future. Also, make sure to use Simulink to reset the ECP after each change in step
amplitude as well as change to the setup to make sure to zero the initial conditions.
Note: You don’t have to re-compile ESCPDSPReset.mdl after each change to the system
but you should connect and run.
sure that you use the correct units for the step input amplitude and the steady-state
value.
5. Repeat steps 1 through 4 for four masses on the cart. Make sure you use the masses in
the same order as you did in part C. Make sure to use Simulink to reset the ECP after
each change to the setup to make sure to zero the initial conditions.
6. You should include the three different estimates of the static gain, K in your lab memo.
It should be in a table and compared to what you got for part C with part D as the
nominal value. Comparison means to use the error formula
14. Choose the initial peak (Peak x(n)) and final peak (Peak x(n+N)) to use in the log-
decrement analysis. These should be fairly close to the beginning of the initial condition
response. Don't try and use more than a few peaks (i.e. 1 and 2 or 2 and 3).
15. Select Estimate Parameters to get the initial estimates of and n.
16. Select Make Log-Decrement Figure to get a plot and summary of the results. You need
to include this figure in your memo (see Figure 10).
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, number of the ECP system (a diagram is
preferable)
A table comparing the estimated values of K, , and n using the two time domain
techniques (note that the damping ratio may have a large error but the other two
parameters should be close)
All required figures with number and caption and they should be referenced in the text
The discussion should include a compare and contrast of the two and four mass models
and how the difference affects the gain, damping ratio and natural frequency.
Lab 2
Frequency Domain Analysis of a 1DOF Rectilinear System
20
10
Magnitude (dB)
-10
-20
-30 1 2 3 4
10 10 10 10
Frequency (rad/sec)
Theory:
Last week the time domain characteristics of the one degree of freedom rectilinear mass-cart-
spring system were found. This week the frequency response of the same system will be
determined. The frequency response involves constructing the magnitude portion of the Bode
plot and fitting this measured frequency response to an expected transfer function to
determine K, and n. The input to the system is a sinusoid, x(t) = A cos(t), where A is
measured in centimeters and the frequency, = 2πf is varied. After a transition period
(transient response), the steady state output will be y(t) = B cos(t + ), where B is also
measured in cm. Since, the magnitude portion of the Bode plot will be constructed, we will
ignore the phase angle, . Figure 2 presents the relationship between the input and output of a
plant in the frequency domain.
y(t)
x(t)
Plant G(s)
Y(s)
X(s)
The frequency response has maximum amplitude at resonance. The center frequency is n at
resonance and the amplitude is 20log10(K). Note that this K is not the static gain, Ko, found in
lab 1, this is the maximum amplitude of the system response in the frequency domain. The
bandwidth is the difference between the two frequencies where the maximum amplitude drops
by 3 dB. The narrowness of the peak is defined by the quality factor (Q) or the damping ratio,
= BW/(2n) ). Since the plant is unknown, there will be some iteration involved in fitting the
theoretical Bode plot to the experimental frequency response data to achieve the best fit.
Since the resonance frequency is so important for finding system characteristics, it is very
important to have several data points around this point. Finally, the Bode plot will be used to
determine an appropriate transfer function model. Figure 3 presents the Bode diagram for the
transfer function,
( )
( )
Procedure:
A. System Setup
1. Create a folder under Documents\ECE320\<your initials\Lab2
2. Copy all of the MATLAB files from the directory you made last week to the folder
created in step 1.
3. Start MATLAB and change the current directory to the one created in step 1.
4. Set up the mass-cart-spring system with two masses that you built last lab with all of the
same spring and mass values in the same location.
5. Every week you should run ECP3.2->Download Controller Personality File->Reset
Controller, first.
B. Frequency Response
1. Modify Model210_Openloop.mdl so the input is a sinusoid. You may have to set the
mode to Normal.
2. Set the frequency to 0.5 Hz, note that in MATLAB the frequency is rad/s so you need to
input (2*pi*0.5). The frequency must be entered in radians/sec!
3. Set the amplitude of the sinusoid to a small value like 0.03 cm. Generally this amplitude
should be as large as you can make it without the system hitting a limit or the system
shutting off. This amplitude may vary with the frequency as you approach resonance.
4. Set the simulation stop time to run for between 1 and 10 seconds just enough so that
the system can reach steady state.
5. Compile Model210_Openloop.mdl, connect Model210_Openloop.mdl to the ECP
system. (The mode should be External.) To avoid compiling Model210_Openloop.mdl
every time you make a change to the amplitude, frequency or simulation stop time, you
should make them all variables such as amp, simtime, freq in the Simulink block diagram
and then vary the values in the MATLAB command window.
6. Run Model210_Openloop.mdl. If the cart does not seem to move much, increase the
amplitude of the input sinusoid. If the cart moves too much, decrease the amplitude of
the input sinusoid.
7. Use Excel to create a data table and record the input frequency (f), input amplitude (A),
and the output amplitude (B) when the system is in steady state.
8. Note that the output may not be a sine wave symmetric about the time axis and you will
need to get the average of the positive and negative values. You can use the MATLAB
file get_B.m to determine this value. After you run get_B.m, the average amplitude of
x1 will be displayed in the command window.
9. Repeat steps 1 through 8 for f = 1, 1.5, 2, 2.5, 3 ….7.5 Hz. Note that as the frequency
gets larger, MATLAB may crash because of the data acquisition and you need to adjust
the input sinusoid amplitude or slightly increase sample steps in the ECP Model 210
DAQ block to minimize this (see Figure 4). You should reset the system by connecting
and running ESCPDSPReset.mdl to zero the initial conditions after each change in
frequency and/or amplitude. You should only have to compile ESCPDSPReset.mdl the
first time you use it.
Figure 4: Adjusting the sample time in the ECP Model 210 DAQ block
10. Modify process_data_1dof.m m-file by entering the measured data of f, A, and B. Note
that you can copy and paste it directly from Excel as long as you format the matrix
appropriately.
11. At the MATLAB prompt, type data = process_data_1dof
40
Measured
35 Estimated
30
25
Magnitude (dB)
20
15
10
-5
1 2
10 10
Frequency (rad/sec)
Figure 35: Experimental Bode magnitude plot with best fit theoretical transfer function
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Lab 3
Analysis of a 2DOF Rectilinear System
Prelab: Read the lab theory and procedure thoroughly. Submit the answer to the
following question on engineering paper the day before lab.
involves using a step response and initial condition response to find the characteristic
parameters. If we assume the surface is frictionless, the equations of motion for the 2 DOF
system are
̈ ̇ (1)
̈ ̇ (2)
If there is no applied force (F = 0) and the second cart is fixed in place (x2 = 0), the characteristic
equation of the first cart (equation (1)) becomes
(3)
If the second cart is free to move and the first cart is fixed in place (x1 = 0), the characteristic
equation of the second cart (equation (2)) becomes
(4)
Thus, the log decrement can be used to estimate 1, 2, 1, and 2.
Procedure:
A. System Setup
1. Create a folder under Documents\ECE320\<your initials\Lab3
2. Download the LAB3.rar files from the Angel class folder to the directory you created in
step 1.
3. Lock the third cart from the motor in place.
4. For the frequency response analysis, the first two carts in the system should move. In
the time domain analysis, each of the first two carts should move alone for the log
decrement or time domain analysis.
5. This week you will decide how to set up the 2DOF system based upon the following
criteria:
Either the carts should have an equal amount of weight on them, or the first cart
should have more weight than the second cart. You need at least one mass on each
cart.
Either all springs connecting carts should have equal stiffness, or the springs should
get less stiff from left to right. You need to use at least two springs.
If you want to use the active damper, unscrew the screw in the damper.
6. Make sure to record a detailed description of the system set up with mass numbers,
locations, spring numbers and locations, damper to include in your lab manual. Creating
a diagram to include in your lab memo would be advisable.
(5)
8. Repeat steps 1 through 7 for at least 3 different input amplitudes and average the
estimated gains. You must include the estimated gains in your lab memo.
a, the estimated first damping ratio when both carts are moving (assume a = 0.1).
b, the estimated frequency of the second resonance, when both carts are moving,
in radians/sec
b, the estimated second damping ratio when both carts are moving (assume b =
0.1).
1, the estimated natural frequency of the first cart when it is the only cart moving
(from the log decrement analysis)
1, the estimated damping ratio of the first cart when it is the only cart moving (from
the log decrement analysis)
2, the estimated natural frequency of the second cart when it is the only cart
moving (from the log decrement analysis)
2, the estimated damping ratio of the second cart when it is the only cart moving
(from the log decrement analysis)
(i.e. model_2dof(data, K2, a, a, b, b, 1, 1, 2, 2))
3. The program model_2dof.m will produce the following:
A graph indicating the fit of the identified transfer function to the measured data for
the first cart
A graph indicating the fit of the identified transfer function to the measured data for
the second cart
The optimal estimates of all parameters (written at the top of the graphs)
A file state_model_2dof.mat in your directory. This file contains the A, B, C, and D
matrices for the state variable model of the system. If you subsequently type load
state_model_2dof, you will load these matrices into your workspace.
4. You need to be sure you have 5 points close to the resonant peaks and nulls of the transfer
functions. After creating the improved model, include the final graph of the curve fit of the
measured data to the identified transfer function in your lab memo for the first and second
cart.
5. Save the state_model_2dof.mat file as Lab3_<your initials>_2dofmodel.mat
6. Save the process_data_2dof.m file as Lab3_<your initials>_data.m
7. Your memo should include an error analysis of the gains, damping ratio and natural
frequencies for cart 1 and cart 2 with frequency domain analysis as the nominal value.
8. Your memo should also include the state equation matrices and transfer function for the
plants.
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Lab 4
Model Matching
Objective: Use model matching to select a controller for a 1DOF and 2DOF system
Use the model to design the control system to meet certain design requirements
such as settling time, steady state error and percent overshoot
Collect data to compare the designed response to the actual response
Prelab: Read the lab theory and procedure thoroughly. Submit the answer to the
following question on engineering paper at the beginning of lab.
Assume that the closed loop system in Figure 1 has a plant, Gp(s), that represents
the mass-cart-spring system that you will control in lab. You will design the
controller, Gc(s) to meet certain system characteristics.
N o ( s) Dp ( s)
Gc ( s)
N p ( s) Do ( s) N o ( s)
∫ ( )
Another performance criterion is the integral of the absolute magnitude of the error, IAE
defined as
∫ | ( )|
To reduce the contribution of the large initial error to the value of the performance integral, as
well as to emphasize errors occurring later in the response. The integral of time multiplied by
the absolute error, ITAE is define by
∫ | ( )|
Coefficients of the closed loop transfer function that minimize the ITAE performance criterion
for a step input have been determined and are summarized in Table 1. Note that the transfer
function has n poles and no zeros. The coefficients for the deadbeat system have also been
determined in Table 1.
n ITAE Deadbeat
2 2
s + 1.4os + o2 s + 1.182os + o2
2
Procedure:
A. File Setup
1. Create a folder under Documents\ECE320\<your initials\Lab4
2. Copy all of the MATLAB files from Lab 3 to the folder created in step 1
3. Copy the 3 1DOF MATLAB model files (Lab2_<your initials>_0_model.mat., Lab2_<your
initials>_2_model.mat., Lab2_<your initials>_4_model.mat.) from Lab 2 to the folder
created in step 1
0 = 25 rad/sec
1.5
Cart 1 (cm)
1
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec)
0.5
Control Effort
-0.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec)
5. Open Model210_Closedloop.mdl and be sure the Base Address is correct for your system.
6. Compile Model210_Closedloop.mdl, the parameters this file needs are in the workspace
after closedloop_driver.m runs. The yellow block is what makes the ECP system work, and
replaces your model of the system with the real system.
7. You should start with the lower step amplitudes, and work your way up to the higher step
amplitudes. Not all systems or controllers will work for a 1 cm step. Your real systems may
oscillate a bit. If this happens try to reduce the input level, since this limits the allowed
control effort. It may not be possible to eliminate all of the oscillations, since these types of
controllers depend on canceling the plant dynamics, and if your model is not accurate
enough the controller will not cancel the real plant well enough.
8. Reset the system by running ECPDSPReset.mdl, connect Model210_Closedloop.mdl to the
system and then run it.
9. Use the compare1.m file (or a modification of it) to plot the results of both the simulation
and the real system on one nice, neatly labeled graph. You may need to modify this file to
get the plot you want. You need to include this graph in your memo. Figure 3 presents an
example of the results of the compare1.m program. Try your best to get similar results.
10. NOTE: You should be prepared that since the controller is designed based upon your model,
it can only be as accurate as your model. Sometimes it may be difficult to meet the design
specifications. If this happens, there will be some tradeoffs and you should do your best to
meet one or two (%OS, ess, Ts) and come close to meeting the other.
0.9 Measured
Predicted
0.8
0.7
Displacement (cm)
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec)
11. Repeat steps 4 through 9 for the third order zero position error ITAE system, second order
deadbeat system, and third order deadbeat system.
12. Repeat steps 2 through 11 for the lab 2 model file for a 1DOF rectilinear system with 4
masses.
Your memo should compare the difference between the predicted response (from the model)
and the real response for each of the systems. Your memo should also compare the results and
performance of the different types of systems (2nd, 3rd, 4th, deadbeat or ITAE).
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, include ECP system number
All required figures with number and caption and they should be referenced in the text
All required data in tables with error analysis referenced in the text, if necessary
Lab 6
Root Locus
Objective: Determine the root locus for a system plant by varying proportional controller
gains
Describe the relationship between controller gains the damping ratio and
damped frequency
Prelab: Read the lab theory and procedure thoroughly. Submit the answer to the
following question on engineering paper in class the day before lab.
Assume that the closed loop system in Figure 1 has a plant, Gp(s), that represents
the mass-cart-spring system that you will control in lab and a proportional
controller, Gc(s) = K.
Gc(s) Gp(s)
error 1
Input +_ K Output
R(s) s3 + 4s2 + 4s
Y(s)
Theory:
Root locus analysis is a technique for plotting the closed loop poles of a control system as the
controller gain, K, is varied using the open loop transfer function. This plot can be used to
quickly identify the ranges for system stability as well as pole locations. In addition, the root
locus can be used to design a system to meet certain design specifications.
Procedure:
A. File Setup
1. Create a folder under Documents\ECE320\<your initials\Lab6
2. Copy all of the MATLAB files from Lab 1 to the folder created in step 1
3. Download the Model210_PControl.zip file from the Angel course folder to the folder
created in step 1
B. System Setup
1. Remove all springs from the system and lock all of the carts except for the first one.
2. Put four 500 gram masses on the first cart.
3. Connect the damper and insert the plug with 2 full turns.
C. Step Response
1. Reset the system by running ECPDSPReset.mdl
2. Use the Simulink model, Model210_PControl.mdl to get the step response data. First, find
the largest gain value to cause marginal stability or slight instability then choose twenty
values below this critical gain. Be careful when you get close to the critical gain; be
prepared to stop the simulation immediately so that you don’t damage the system! As a
point of reference, for my system the range of values was between 0.02 and 0.5. Figure 1
provides two examples of the step response right before and right after it becomes
unstable.
3. You should set the value of K in the MATLAB command window and then run
Model210_PControl.mdl. You should run the simulation until the system reaches steady
state most likely between 0 and 15 seconds.
4. Save the workspace after each step response so that you have access to the x1 and time
variables for later analysis.
5. Make sure to use ECPDSPReset.mdl to reset the system after each data set.
a. stable b. unstable
2. For each controller gain, K, use the log-decrement method by running the m-file, log_dec.m
to determine the damping ratio and natural frequency.
3. Use Excel to create a table of controller gains (K), damping ratio (), natural frequency (n),
damping factor (d) and damped frequency (d).
4. Create a plot of the damping ratio () versus gain to include your memo and describe the
relationship between the two (see Figure 3).
5. Create a plot of the damped natural frequency (d) versus gain to include in your memo
and describe the relationship between the two (see Figure 3).
6. Recall that the closed-loop poles of the system are given by -d ± jd = -n ± d. Create a
plot of the root locus of the experimentally determined closed loop poles as a function of
controller gain (see Figure 4). This plot should be included in your lab memo submission.
root locus
40
20
imaginary
0
axis
-4 -3 -2 -1 0
-20
-40
real axis
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, include ECP system number
All required figures with number and caption and they should be referenced in the text
All required data in tables with error analysis referenced in the text, if necessary
Lab 7
PID control
Objective: Design a PID and PD controller for the one degree of freedom system to satisfy
certain system characteristics
Evaluate the performance differences between a PD versus PID controller
Prelab:
Read the lab theory and procedure thoroughly. Review the Root Locus for Controller Design
and Introduction to Sisotool document posted in the Angel Course Folder. Use the instructions
in this document to practice using sisotool not for submission. However, you should submit the
following in class the day before lab.
1. You and your lab partner should select different state variable models from the 1 degree of
freedom systems created in Lab 2.
1. Use the closedloop_driver.m file from Lab 2 to load the correct state model into the
system. This driver simulates the designed controller in the closedloop.mdl.
2. Comment out all of the other controllers and add the following lines:
kp = 0.5; % dummy value for proportional gain
ki = 5.0; % dummy value for integral gain
kd = 0.01; % dummy value for derivative gain
Gc = tf(kp,1) + tf(ki,[1 0]) + tf([kd 0],[1/50 1]);
Go = feedback(Gc*Gp,1);
3. Note that we have modified the derivative controller so that it is in series with a one pole
lowpass filter with pole at 50 (about 8 Hz). This will help smooth out the derivatives and
avoid the noise at the beginning of the step.
4. You will need to be able to determine the PID controller coefficients from the controller.
This is easiest done by equating coefficients. For example, if the PID controller is given by
( )
( )
kp 0.5
ki 5
kd 0.01
6. Your resulting design must have a settling time of 1.0 seconds or less and must have a
percent overshoot of 25% or less. Note that sisotool defaults to an input of 1 which is
acceptable for design purposes.
7. If you don't know how to get the correct plant transfer function, run closedloop_driver.m
(with the correct model file) and it will put the correct transfer function Gp(s) into your
Matlab workspace.
8. Implement the PID controller for the gains found in sisotool by putting them in the
closedloop_driver.m file. Use a step with amplitude 0.5 cm in your closedloop_driver.m
file.
9. Run the closedloop_driver.m, plot the control effort for approximately 0.2 seconds since
the control effort is usually largest near the initial time. If your control effort reaches its
limits, you need to go back to sisotool and modify your designs. See Figure 1 for an
example of bad control effort.
PID Controller complex zeros
1.5
Cart 1 (cm)
0.5
0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
Time (sec)
0.5
Control Effort
-0.5
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
Time (sec)
10. If your control effort is not near the limit, you can increase the gains, particularly the
derivative gain and simulate again. You can repeat this process until you are happy with the
design.
11. Run your simulations for 2.0 seconds. Plot both the system output (from 0 to 2 seconds) and
the control effort (from 0 to 0.2 seconds). Put a title on your plot to identify kp, ki, and kd.
Look at previous code to determine how to do this. Submit your plot as part of your prelab
submission.
12. Our new transfer function has introduced finite zeros into the closed loop transfer function.
We now want to use a dynamic prefilter to eliminate these zeros, so long as they are in the
left half plane. We also need Gpf (0) 1 . Hence we have
Do (0)
G pf ( s)
N o ( s)
13. You should set the dynamic prefilter in MATLAB by commenting out your old prefilter code
and creating code to implement the dynamic prefilter. This will cancel out the zeros of the
closed loop system. Your numerator polynomial for the closed loop transfer function, No(s)
should be second order. You can use the following code to create the dynamic prefilter:
[num_Go,den_Go] = tfdata(Go,'v');
num_Gpre = den_Go(end);
den_Gpre = num_Go;
14. Run your simulation again with the dynamic prefilter and compare the results and discuss
similarities and differences.
15. You should submit 4 plots for your prelab including PID real zeros with and without the
dynamic prefilter, PID complex zeros with and without the dynamic prefilter.
Theory:
PID control can be used to adjust a system to meet given steady-state and transient
characteristics. Proportional control as well as a prefilter can be used to adjust the steady-state
error. Derivative control adjusts the transient characteristics such as settling time and rise
time. Integral control adjusts the steady-state characteristics such as stability and steady-state
error. Figure 1 provides a closed loop transfer function with a prefilter, which is used to
condition an input signal by changing the units or to fix the final value of the output.
( ) ( ) ( )
( )
( ) ( ) ( )
compensator plant
H(s)
Procedure:
A. File Setup
1. Create a folder under Documents\ECE320\<your initials>\Lab7
2. Copy all of the MATLAB files from Lab 2 to the folder created in step 1
3. Modify closedloop_driver.m to read in the correct model file. You may have to copy this
model file to the current folder.
B. System Setup
1. Start by building the one degree of freedom mass-cart-spring system with two masses
exactly as you did in lab 2
2. For each of the one-degree of freedom systems, you will try to adjust the controller
parameters until you have achieved the following:
Settling time less than 1.0 seconds.
Steady state error less than 0.1 cm for a 1 cm step
Percent Overshoot less than 25%
E. PD Control
1. Design a PD controller with a real zero using sisotool to meet the design specifications. You
may not be able to meet the percent overshoot constraint but do the best you can. You can
use a constant prefilter for the design but the value probably won’t be one. Use the
constant prefilter to correct the steady-state error.
2. Implement the correct gains into the closedloop_driver.m.
3. Run closedloop_driver.m to simulate the system for 1.5 seconds. If the design constraints
are not met, or the control effort hits a limit, redesign your controller (you might also try a
lower input signal)
4. Reset the system by running ECPDSPReset.mdl
5. Compile and run Model210_Closedloop.mdl and connect to the system to run the actual
hardware response
6. Use the compare1.m to plot the results of both the simulation and the real system on one
nice, neatly labeled graph. You need to include this graph in your memo. Be sure to include
an informative title, x and y labels and the values of Kp, Ki and Kd in your memo.
7. Change the prefilter to cancel the zeros of the closed loop system and still have a steady
state error of zero. Rerun the simulation and compare the predicted with the measured
response. You also need to include this graph in your memo. Be sure to include an
informative title, x and y labels and the values of Kp, Ki and Kd in your memo.
8. Repeat steps 1 through 7 for the one degree of freedom system with four masses.
Your memo should include six graphs for each of the 1 dof systems you used (two different PID
controllers and one PD controllers with and without dynamic prefilters.) Be sure to include the
values of k p , ki , and kd and whether the PID controller had real zeros or complex conjugate
zeros in the captions for each figure. Your memo should compare the difference between the
predicted response (from the model) and the real response (from the real system) for each of
the systems. How does the use of a dynamic prefilter change the response?
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, include ECP system number
All required figures with number and caption and they should be referenced in the text
All required data in tables with error analysis referenced in the text, if necessary
The discussion should include a comparison and contrast of the performance of the
different PID and PD controllers with and without real or complex conjugate zeros with
and without dynamic prefilters
The discussion should also compare the designed controllers and response for the two
and four mass systems
Lab 8
PID control
Objective: Control the one degree of freedom system previously modeled using PI-D and I-
PD controllers with and without dynamic prefilters
Evaluate the performance differences between PI-D and I-PD controllers
Prelab:
Read the lab theory and procedure thoroughly and complete the following prelab for
submissions in class the day before lab.
For each of the one degree of freedom systems, try to adjust the parameters until you have
achieved the following
Settling time less than 1.0 seconds.
Steady state error less than 0.1 cm for a 1 cm step
Percent Overshoot less than 25%
kp 0.5
ki 5
kd 0.01
1. Use sisotool to determine the values of kp, ki and kd for the PI-D and I-PD controllers by first
setting the control architecture to get the proper configuration (see Figure 1).
2. Select the correct architecture and make sure that sisotool uses negative feedback for both
loops (see Figure 2).
8. There will now be a design window with 2 empty root locus plots. For practice assume that
938.4
the plant is G p ( s) 2
s 1.25s 329.8
9. After this plant is imported into sisotool, there will be a design window and two identical
proportional controllers shown in Figure 5.
10. To design the PI-D controller, let C2(s) = kds and don’t worry about the lowpass filter at this
time. Assume that kd = 0.01; to assign this to the controller C2 select Designs, Edit
Compensator, then select C2 in the compensator window and enter the controller.
0.15( s 15)
11. To design the PI part of the controller into C1(s), assume that C1 ( s) and enter
s
this into C1. If you have done this correctly, you should get the root locus plots in Figure 6.
12. The step response for this controller configuration is shown in Figure 7.
13. Note that, compared to a normal PID controller, the control effort is not infinite at 0, and
actually builds as time goes on (like an integral controller). At this point we might want to go
back to modify the controllers, C1 and C2, to get acceptable performance. Note that it is
possible to modify the two controllers (and gains) independently.
14. Now assume that you will control the same plant but use an I-PD controller. Assume that
the controllers have the form
1.5
C1 ( s) , C2 ( s) 0.01(s 1)
s
15. If you entered the controllers correctly, you should get the root locus plot shown in Figure
8.
16. The step response for the I-PD controller is shown in Figure 9.
Theory:
While PID controllers are very versatile, they have a number of drawbacks. One of the major
drawbacks is that for a unit step input, the control effort u (t ) can be infinite at the initial time.
This is referred to as a set-point kick. There are two commonly used configurations of PID
controls schemes that utilize a different structure, the PI-D and the I-PD controllers. These are a
bit more difficult to model using Matlab’s sisotool, but it can be done.
The PI-D controller avoids the set-point kick by putting the derivative in the feedback path,
while the I-PD controller avoids the set-point kick by placing both the derivative and
proportional terms in the feedback path. Both types of controllers can be implemented using
the Simulink model shown in Figure 10, which you will construct and name appropriately.
ki kd s
C1 ( s) k p , C2 ( s)
s 1
s 1
50
For the I-PD controller, the transfer functions are: we have
ki kd s
C1 ( s) , C2 ( s) k p
s 1
s 1
50
Note that for both controllers, the lowpass filter with a cutoff of 50 rad/sec is put in series with
the differentiator to clean up the signal. For both of these controllers, if we ignore the prefilter
and assume it is unity then the transfer function from input to output is
Y ( s) C1 ( s)G p ( s)
R( s) 1 C2 ( s)G p ( s) C1 (s )G p (s )
Procedure:
A. File Setup
1. Create a folder under Documents\ECE320\<your initials>\Lab8
2. Copy all of the MATLAB files from Lab 7 to the folder created in step 1
3. Modify closedloop_driver.m to read in the correct model file and implement the new
structure. Make sure to comment out the old PID controller. In particular, it must now
create C1(s) and C2(s), as well as the closed loop transfer function similar to the following:
C1 = tf(kp,1) + tf(ki,[1 0]);
[num_C1,den_C1] = tfdata(C1,'v') ;
C2 = tf([kd 0],[1/50 1]);
[num_C2,den_C2] = tfdata(C2,'v') ;
B. PI-D control
1. Set up the 1 DOF mass-cart spring system with two masses exactly the way you did when
you determined the model parameters.
2. Design a PI-D controller to meet the design specifications. You may have already done this
in the prelab. Use a constant prefilter (i.e., a number, most likely the number 1) and be sure
to observe the limits on the controller gains.
3. Implement the correct gains into closedloop_driver.m
4. Simulate the system for 1.5 seconds, if the design constraints are not met, or the control
effort hits a limit, redesign your controller (you might also try a lower input signal)
5. Once you are happy with the simulated design, reset the system by running
ECPDSPReset.mdl
6. Compile and run Model210_PID_<your initials>.mdl and connect to the system to run the
actual hardware response
7. Use the compare1.m file to plot the results of both the simulation and the real system on
one nice, neatly labeled graph. You need to include this graph in your memo. Make sure
to add a descriptive title that includes the values of Kp, Kd and Ki and axis labels.
8. Change the prefilter to cancel the zeros of the closed loop system and still have a steady
state error of zero. Rerun the simulation and compare the predicted with the measured
response. You also need to include this graph in your memo. Be sure to include an
informative title, x and y labels and the values of Kp, Ki and Kd in your memo. Note that you
will have to create the closed loop transfer function and then use that to create the
dynamic prefilter.
9. Repeat steps 1 through 8 for the one DOF system four mass system.
I-PD Control
1. Set up the 1 DOF mass-cart spring system with two masses exactly the way you did when
you determined the model parameters.
2. Design a I-PD controller to meet the design specifications. You may have already done this
in the prelab. Use a constant prefilter (i.e., a number, most likely the number 1) and be sure
to observe the limits on the controller gains.
3. Implement the correct gains into closedloop_driver.m
4. Simulate the system for 1.5 seconds, if the design constraints are not met, or the control
effort hits a limit, redesign your controller (you might also try a lower input signal)
5. Once you are happy with the simulated design, reset the system by running
ECPDSPReset.mdl
6. Compile and run Model210_PID_<your initials>.mdl and connect to the system to run the
actual hardware response
7. Use the compare1.m file to plot the results of both the simulation and the real system on
one nice, neatly labeled graph. You need to include this graph in your memo. Make sure
to add a descriptive title that includes the values of Kp, Kd and Ki and axis labels.
8. Change the prefilter to cancel the zeros of the closed loop system and still have a steady
state error of zero. Rerun the simulation and compare the predicted with the measured
response. You also need to include this graph in your memo. Be sure to include an
informative title, x and y labels and the values of Kp, Ki and Kd in your memo.
9. Repeat steps 1 through 8 for the one DOF system with 4 masses.
Your memo should include four graphs for each of the 1 DOF systems you used (one PI-D and
one I-PD controller with and without dynamic prefilters.) Be sure to include the values of k p , ki ,
and kd in the captions for each figure. Your memo should compare the difference between the
predicted response (from the model) and the actual response (from the real system) for each of
the systems. How does the use of a dynamic prefilter change the response?
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, include ECP system number
All required figures with number and caption and they should be referenced in the text
All required data in tables with error analysis referenced in the text, if necessary
The discussion should involve a comparison and contrast of the PI-D and I-PD controllers
with and without the dynamic prefilter.
The discussion should also include the differences in performance between the two and
four mass systems
Lab 9
State Variable Feedback – Inverted Pendulum
Objective: Control the one degree of freedom system using state-variable feedback
Control the two degree of freedom system using state-variable feedback
Model, simulate and control a regular and inverted pendulum on a cart
This week’s prelab and lab procedure are very long. Therefore, it is very important that you
start early and prepare as much as possible in advance in order to finish the lab in the allotted
time.
Prelab:
Read the lab theory and procedure thoroughly. Submit the following prelab on engineering
paper at the beginning of lab.
a) One lab partner should complete the prelab on the two mass 1DOF system and the 2DOF
system models built in Labs 2 and 3. The other lab partner should complete the prelab on
the four mass 1DOF and the 2DOF system models built in Labs 2 and 3.
b) Set the saturation_level to the correct level for the rectilinear system (model 210) and
comment out the model 205 saturation level. Assume a step input of 1 cm (Amp = 1.0;)
and comment out the amplitude in radians, this is for the torsional system.
c) Set the final simulation time to 2 seconds (Tf = 2.0;)
d) Modify Basic_1dof_State_Variable_Model_Driver.m to load the correct 1DOF state model
into the system (load 2_mass_model;).
e) Design a state variable feedback system using pole placement for the one degree of
freedom rectilinear system (p=[p1 p2]; K = place(A,B,p);). Determine the
characteristic equation and closed loop poles for the step response (output) of the system
to have:
A settling time less than or equal to 0.5 seconds
A percent overshoot less than or equal to 10%
f) You should include the derivation of the characteristic equation and closed loop poles on
engineering paper with your prelab submission. Note that there may be some iteration on
these values to meet the design specification during the simulation and lab procedure but
this process gives you a starting point for the process.
g) To set the location of the closed loop poles, find the part of the code that assigns poles to
the variable p, and change the elements of p. The biggest problem is to make sure the
control effort is not too large. Your design should not saturate the system (control effort)
and you should use a constant prefilter as defined in the driver m file, (Gpf = 1.0;).
h) Plot both the system output (from 0 to 2 seconds) and the control effort (from 0 to 0.2
seconds). Plot the control effort only out to 0.2 seconds since the control effort is usually
largest near the initial time. If your control effort reaches its limits (±0.4), you need to go
back and modify your design. Submit your plot with a descriptive title, the axes labeled and
the closed loop poles and gains printed on it.
should include the derivation of the characteristic equation and closed loop poles on
engineering paper with your prelab submission. Note that there may be some iteration on
these values to meet the design specification during the simulation and lab procedure but
this provides a starting point.
e) To set the location of the closed loop poles, find the part of the code that assigns poles to
the variable p, and change the elements of p. The biggest problem is to make sure the
control effort is not too large. Your design should not saturate the system (control effort)
and you should use a constant prefilter as defined in the driver m file.
f) Run your simulation for 2.0 seconds. Plot both the system output (from 0 to 2 seconds) and
the control effort (from 0 to 0.2 seconds). Plot the control effort only out to 0.2 seconds
since the control effort is usually largest near the initial time. If your control effort reaches
its limits (±0.4), you need to go back and modify your design. Submit your plot with a
descriptive title, the axes labeled and the closed loop poles and gains printed on it.
Use the results of simulation of the regular pendulum to model the inverted pendulum. Use the
same model and driver files but you need to change the state model. Specifically, you need to
Set the initial value of the pendulum to 0.05 radians and all other initial conditions to
zero.
Use the pole placement method to control the position of the pendulum and the cart.
The goal is to keep the pendulum pointing straight up and keep the cart from moving
more than about 2.5 cm in each direction. The control effort should also be less than 0.4
and the system should come to steady state in less than 1.0 seconds. Limiting the cart
motion is usually the most difficult part. Often your controller for the regular pendulum
will work for this part too, but not always.
Once you have a satisfactory design, you should plot the system output and control
effort from 0 to 2 seconds and submit it with a descriptive title, the axes labeled and the
closed loop poles and gains printed on it.
Theory:
Review your lecture notes and study guide for the essential theory on pole placement for state-
variable feedback.
In this derivation we will make a state variable model for a regular pendulum (a pendulum
hanging down) attached to the first cart. It will be easier to measure the parameters for a
regular pendulum since it is a stable system. In the lab we will initially try and control the
regular pendulum. Once this is working, we will try to control an inverted pendulum. Note that
the inverted pendulum is an unstable system. To go from the model of a regular pendulum to
the model of an inverted pendulum we use the substitution l – l. Consider the
configuration for the regular pendulum shown in Figure 1.
The mass of the cart is M, center of mass of the pendulum is m, the moment of inertia of the
pendulum about its center of mass is J, L is the length of the pendulum, and l is the distance
from the pivot to the center of mass of the pendulum. The angle is measured
counterclockwise from straight up, x is the displacement of the first cart (positive to the right),
and g is the gravitational constant.
Using a small angle/small velocity assumption, we can approximate the above equations of
motion as
( J ml 2 ) mlx mgl 0
M m x ml cx kx F
The first equation can be rewritten as ̈ ̈
This is the equation for a simple pendulum. If the pendulum is deflected a small angle and
released, it will oscillate with frequency, . It is possible to measure the period of oscillations,
T, and use that to find .
If we assume there is no input (F = 0) and the pendulum does not move very much (̈ ) then
we can use the log-decrement method to get initial estimates of 1 and 1. Assuming we apply
a step input of amplitude A to the cart then the steady state value is .
The transfer function between the cart position and pendulum angle can be found from the
first equation of motion as
( s) 2
s2
2
X (s) g s 2
To measure the gravitational constant in cm, the transfer function between the cart position
and input force in cm is given by
X ( s) 2
K2 (s 2 2
)
1
F ( s) 4
2
1 K1 s 2 s3 ( ) s 2 (2 )s
2 2 2 2 2 2
1 1 1 1 1 1 1
g
This expression can be use do to determine K1 and get better estimates of 1 and 1.
1
2
x 2
g
x 2 1 1 x 2
1 x K1 12 K 2 2
1 F
1 2
2
12 1 1 2
2 2
K2
x 1
1
1
x
2
1
F
g g g
where
K1 12 2
1
g
and substituting the first equation into the second equation we get
x
1
2
1 x 1 2 1 1 x
1
K1 2
1
2
1 K F
2
2
1
0 1 0 0 0
q1 1 2 1 1 K1 1 q1 K 2 1
2 2 2 2
q 0
2 q
2 F
q3 0 0 0 1 q3 0
2 2 q
q4 1 2 1 1 4 1 K2
2 2 2 2
g g
0
g
If we now want to model the inverted pendulum (l –l), how do the terms change in the
matrices above? In lab, we will see that when we try to fit the frequency response data, you
will get an unusual response. To understand this response you will obtain values of
ml
K1
k
k
2
M m
1
mgl
2
J ml 2
If we assume that the mass of the cart and pendulum attachment is much larger than the mass
at the center of mass of the pendulum, then we have M is much larger than m. Secondly, J is
the moment of inertia about the center of mass of the pendulum, m is the mass at the center of
mass of the pendulum, and l is the distance from the pivot to the center of mass of the
pendulum. For our systems, the pendulum bars have negligible mass and all of the mass is
essentially concentrated at the center of mass hence ml2 is much larger than J. Using these two
assumptions yields 1 and the system transfer function becomes
2
X (s) 1 K2
2
F ( s ) s 2 1 1s 2
1
That is, there is a pole/zero cancellation! This is the effect you will often see in lab.
Procedure:
A. File Setup
1. Create a folder under Documents\ECE320\<your initials>\Lab9
2. Extract all of the Lab9.zip files from the Angel course folder to the folder created in step 1.
Make sure to use the version of the files you have modified for the prelab.
3. Copy all of the 1DOF and 2DOF system models from Labs 2 and 3 into the folder created in
step 1.
5. Open Model210_sv1.mdl and confirm that the base address is correct. Then compile the
closed loop ECP Simulink driver, Model210_sv1.mdl, connect to the system, and run the
simulation
6. Use the compare1.m file (or a modification of it) to plot the results of both the simulation
and the real system on two nice, neatly labeled graphs using the subplot command. It is
two graphs because you need to compare both the position and the velocity of the cart
(see Figure 2 for an example). You need to include these graphs in your memo submission.
(Note: the steady state error is likely to be off. Placing the poles farther away can reduce this
error for these systems.)
7. Repeat steps 1 through 6 for the 1DOF system with 4 masses. You should compare and
contrast the results of these analyses in your memo.
Measured
Predicted
0.5
0
0 0.5 1 1.5
Time (sec)
20
Measured
Velocity (cm/s)
15 Predicted
10
0
0 0.5 1 1.5
Time (sec)
3. Design a state variable controller using pole placement to control the position of the first
cart to meet the design specifications (C = [1 0 0 0];). You may have already done this
for the prelab.
4. Simulate the system for 1.5 seconds, if the design constraints are not met, or the control
effort hits a limit; redesign your controller (you might also try a lower input signal). You
may have already done this in the prelab.
5. Open Model210_sv2.mdl and confirm that the base address is correct. Then compile the
closed loop ECP Simulink driver, Model210_sv1.mdl, connect to the system, and run the
simulation
6. Use the compare1.m file (or a modification of it) to plot the results of both the simulation
and the real system on four nice, neatly labeled graphs using the subplot command. You
need to compare both the position and the velocity of both of the carts. You need to
include these graphs in your memo.
7. Repeat the above steps to design a state variable controller using pole placement to control
the position of the second cart to meet the design specifications (C = [0 0 1 0];).
0.4
0.3
0.2
0.1
theta(rads)
-0.1
-0.2
-0.3
-0.4
-0.5
0 1 2 3 4 5 6 7 8 9 10
time (sec)
Figure 3: Estimation of .
̈ ̇
2. Use the log-decrement method to get estimates of 1 and 1 by displacing the cart and
running Model210_Openloop.mdl
3. Lastly, run the log_dec.m MATLAB file to generate the estimate of the system parameters.
Note that you may have to copy the log_dec.m and log_dec.fig files from one of the earlier
lab folders.
d. Estimation of K2
1. Modify Model210_Openloop.mdl to have amplitude of “0.1”, apply a step input of
amplitude A to the cart and estimate K2 by using the formula,
x
K 2 ss
A
2. Compile and run Model210_Openloop.mdl and view the variable x1 in the MATLAB
command window to find xss. Calculate the gain using the formula in step 1.
3. Reset the system to have zero initial conditions by running ESCPDSPReset.mdl
4. Repeat steps 2 through 5 for two more different input amplitudes.
5. Calculate K2 as the average of the 3 gains found.
from recompiling Model210_Openloop.mdl after each run. Make sure that the system
reaches steady state before you measure the amplitude! You should change the simulation
stop time if it does not reach steady state.
4. Create an Excel file to record the input frequency (f), the amplitude of the input (A), and the
amplitude of the output (B) when the system is in steady state. Use the MATLAB program,
get_B.m, to get the average of the output amplitude.
5. You will probably notice that the output does not look quite as sinusoidal as usual. This is
because we are not really giving the pendulum enough time to reach steady state. Enter
the values of f, A, and B into the program process_data_pendulum.m
6. At the Matlab prompt, type data = process_data_pendulum;
Create a data table with gridlines in the lab memo submission that shows the measured,
nominal, and percent error for the system parameters.
You should include the final improved graph with a descriptive title as well as the state
variables (A, B, C, D) and transfer function in your lab memo submission.
K2 = 9.7538, t
= 6.61, 1 = 0.0576, 1
= 17.2, = 0.999
Measured
Estimated
35
30
Magnitude (dB)
25
20
15
1
10
Frequency (rad/sec)
g. Control the ECP system with Simulink for the Regular Pendulum
1. We will now try to control the regular pendulum that you just modeled. This is actually a
regulator problem in that you will try to maintain a set point (i.e., keep the pendulum
pointing down).
2. Using the program Basic_2dof_State_Variable_Model_Driver_pend.m and the
corresponding state variable model file (regular_pend_model.mat), simulate the system
with zero input, and all initial conditions set to zero except for the initial pendulum
displacement. Set the initial pendulum displacement to something like 0.01 radians
(ic_theta = 0.01;)
3. Use state variable feedback so that the first cart moves to keep the pendulum pointing
down (the pendulum angle is zero degrees) with a settling time of less than 1.0 seconds.
Use the direct pole placement method to determine the feedback gain values. You also
need to be sure the control effort is less than 0.4 and the cart does not move more than
about 2.5 cm. You can use your prelab design as a good starting point for the pole
placement. You can also try to place the poles at -5, -7, -9, -11. Try to make sure that the
first two gains are less than 0.2 if possible. See Figure 5 for an example of an acceptable
design from the simulation.
4. Once you are happy with your design, you can set the simulation final time to 20 seconds
(Tf = 20;).
5. Confirm that the pendulum is pointing straight down and is at rest. Reset the system using
ECPDSPReset (this is how the ECP finds its zero).
6. Now try to compile and run Model210_Regular_Pendulum.mdl to control the ECP system
with these same parameters. Since there is no input, the system should do nothing. Use a
pencil or ruler to gently nudge the pendulum. The cart should move so the pendulum
returns to an angle of zero degrees. If your system does not seem to work very well, do not
go on to the next part until you've figured out what is wrong.
-3
Regular Pendulum, k = -0.074975, 0.014322, -1.9557, 0.086958 x 10 Poles, p = -5, -7, -9, -11
0.15 10
0.1
5
0.05
0
0
-0.05 -5
0 0.5 1 1.5 2 0 0.5 1 1.5 2
time (sec) time (sec)
1.5 0.1
Pendulum Velocity (rad/sec)
Cart Velocity (cm/sec)
1
0.05
0.5
0
0
-0.05
-0.5
-1 -0.1
0 0.5 1 1.5 2 0 0.5 1 1.5 2
time (sec) time (sec)
-3
x 10
10
0.4
0.2
Control Effort
Input/Output
0
-0.2
Output
Input -0.4
-5
0 0.5 1 1.5 2 0 0.05 0.1 0.15 0.2
time (sec) time (sec)
i. Control the ECP system with Simulink for the Inverted Pendulum
1. This is much more difficult than controlling the regular pendulum, since the system is
inherently unstable. You should expect failure until you get the hang of it. The biggest
problem is that you must start holding the pendulum nearly vertical. If you are off even
slightly in holding the pendulum vertical the system will not work. In addition, it is very
important to complete the following steps explicitly. Make sure you read all of the steps
before you run the inverted pendulum system!
2. Simulate the system with zero input, and all initial conditions set to zero except for the
initial pendulum displacement (0.01 rads). Use state variable feedback so the first cart
moves to keep the pendulum pointing up with a settling time of less than 1.0 seconds. You
can use your prelab values as a good starting point for the pole placement.
3. Confirm that the pendulum is pointing straight down and is a rest. Reset the system using
ECPDSPReset (this is how the ECP zeros). You must always do this step before you try and
run the inverted pendulum!
4. To control the inverted pendulum through the ECP system, you must use the file
Model210_Inverted_Pendulum.mdl. Compile this with your parameters by running
Basic_2dof_State_Variable_Model_Driver_pend.m. Make sure that you modify this file to
load the inverted pendulum model (load inverted_pend_model;).
5. Connect to the ECP system, but do not start the simulation. Gently rotate the pendulum up
to vertical and hold it loosely between your fingers. Run the simulation while still holding
the pendulum loosely. If the system moves rapidly when started you need to let go of the
pendulum and stop the system. If the system does not move much, gently let go of the
pendulum.
6. While the pendulum is vertical, gently blow on it. This should provide some external
disturbance which the system should be able to overcome. This is feedback control in
action. See Figure 6 for an example of the working system.
7. If the ECP system does not work (or buzzes), first try resetting the system. Then try making
the closed loop poles closer to the origin. Be sure to rerun the model
(Basic_2dof_State_Variable_Model_Driver_pend.m) of the system to get all the necessary
parameters in the workspace before compiling the ECP system.
8. Demonstrate the working inverted pendulum to your instructor.
Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, include ECP system number
All required figures with number and caption and they should be referenced in the text
All required data in tables with error analysis referenced in the text, if necessary
Lab 10
Integral Control and Observers – State Variable Feedback
Objective: Control the one degree of freedom system with a full order observer
Control the one degree of freedom system with full order observer and integral
control
Control the two degree of freedom system with a full order observer
Control the two degree of freedom system with full order observer and integral
control
Prelab:
Read the lab theory and procedure thoroughly and complete the following prelab for submission
in class the day before lab. Note that this prelab is very long and it is recommended that you
start early and complete it in its entirety to save time during the lab session. Since the prelab is
such an integral part of this week’s lab, it will be worth 40% of the lab grade.
In this prelab, we will simulate and study integral control, full order observers and then the fully
integrated system with state variable feedback. This type of integrator in the system is
preferable to a prefilter in order to achieve zero steady state error for a step input, since it will
help overcome errors in the plant model. Many of these steps of this prelab will be
implemented to confirm that the programs are working correctly.
1) For all of the problems in the prelab, use the state models for the rectilinear systems posted
in the Angel course folder (prelab10.rar).
2) Confirm in SIMULINK that you use a variable step solver, and the maximum time step is
approximately 1e-5. You can do this by going to the following: Simulation-> Configuration
Parameters. Also, set the initial conditions on the integrators to a 0 (a scalar).
3) You need to save plots of every case you are run. You can paste them into a Word
document with appropriate figure captions and submit it via email.
7) Modify sv1_integral_driver.m to plot the two states and the control effort. Set the step
amplitude to 1.0, the final time to 2.5 seconds, place the poles at -5, -10, -15, and run the
simulation. You should get results like those shown in Figure 2.
8) Assume that this system must be designed to settle in less than 2 seconds, have less than
15% overshoot and zero steady-state error.
poles = -5 ,-10 ,-15 and K = -0.10317, 0.0086073, -0.22433
1 2.5 0.2
0.8 2
0.15
Control Effort
0.6 1.5
0.1
0.4 1
0.05
0.2 0.5
0 0 0
0 1 2 3 0 1 2 3 0 1 2 3
time (sec) time (sec) time (sec)
Figure 2: Initial results for the 1 DOF system with integral control
9) At this point there is no real reason for us to use integral control, since we know everything
exactly and there is zero steady-state error. Let’s assume your lab partner is has derived a
state model that is way off from the actual system. In your code, just before your run the
simulation (just before the sim command), type A = A*0.75, which basically makes the A
state matrix way off from the designed model. If you make this change just before the
simulation, your gains will be chosen assuming your model is correct, and we will be
running the simulation using a different system. You should get results like those shown in
Figure 3, which look pretty hopeless, but we can improve them.
poles = -5 ,-10 ,-15 and K = -0.10317, 0.0086073, -0.22433
1.4 5 0.2
1.2 4
0.15
Cart Velocity (cm/sec)
1 3
Cart Position (cm)
Control Effort
0.8 2
0.1
0.6 1
0.4 0
0.05
0.2 -1
0 -2 0
0 1 2 3 0 1 2 3 0 1 2 3
time (sec) time (sec) time (sec)
10) Systems with these integrators have an interesting characteristic that they correct the error
and high frequency noise. Change the poles to -5, -10, and -35 and rerun the system; you
should get the results shown in Figure 4, which are much better. Note that the control
effort is also much better. Before you go on, be sure to remove the line A = A*0.75!
1.2 0.14
3
0.12
Control Effort
2 0.1
0.8
0.08
0.6
1
0.06
0.4
0.04
0
0.2 0.02
0 -1 0
0 1 2 3 0 1 2 3 0 1 2 3
time (sec) time (sec) time (sec)
Figure 4: Integral control with a bad system model and better gains
1) In this problem we will incorporate integral control for a two degree of freedom system and
run some test cases to verify your code is working.
2) Copy your program Basic_2dof_State_Variable_Model_driver.m to the Lab 10 folder and
rename it sv2_integral_driver.m. Then copy the Simulink file
Basic_2dof_State_Variable_Model.mdl to the Lab 10 folder and rename it,
sv2_integral.mdl.
3) Modify these new files to implement state variable feedback using integral control. For
sv2_integral_driver.m this includes loading the 2DOF model for the rectilinear system
(load state_model_2dof_rect). This also includes defining the A and B matrix for
the integral controller in order to place the poles,
[ ] [ ]
4) You should also set all of the initial conditions on the integrators to zero
(ic_x1=0;ic_x2=0;ic_x1_dot=0;ix_x2_dot=0;). Lastly change the simulation
to the new model file (sim(‘sv2_integral.mdl’);). You may also have to define
the C matrix dependent upon whether you want the output to be the first or second cart
position or velocity.
5) The process to modify sv2_integral.mdl will be similar to that completed for the 1DOF
system. You will need to add a summer after the step input that subtracts the output y.
Then you will add an integrator with zero initial condition and gain KI after the summer.
This is now the new input to the summer in the original model and everything else remains
the same.
6) Modify sv2_integral_driver.m to plot the four states, output and the control effort.
7) Set the amplitude to 1.0 and the final time to 2.5 seconds, and place the poles at -5, -10, -
15,-20, and -5. Run the simulation and you should get results similar to those shown in
Figure 5.
poles = -20 ,-15 ,-10 ,-5 ,-5 and K = 0.096, 0.015, -0.17, -0.0035 , 0.1 Input/Output
1 1 1
Cart 1 Position (cm)
Input
Output
0 0 0
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
1.5 2 0.2
Cart 1 Velocity (cm/sec)
Control Effort
1
1 0.1
0.5
0.5 0.05
0 0 0
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
8) Assume your lab partner made a mistake in the system analysis and your model is not
accurate. You will simulate this error by setting the A matrix to 0.75*A after the gains
have been determined for the poles in step 6. Run the simulation for 3 seconds and the
results should look similar to Figure 6. Note that it does not meet the settling time and
percent overshoot requirements anymore.
9) The benefit of integral control is that this bad model can still be designed to improve the
response by increasing the integral controller gain. Set the poles to -5, -10, -15,-20, and -25
and run the simulation for 2s again. You should get results similar to those in Figure 7. If
your results agree, remove the line A = 0.75*A from your code.
poles = -20 ,-15 ,-10 ,-5 ,-5 and K = 0.096, 0.015, -0.17, -0.0035 , 0.1 Input/Output
1.5 2 1.5
Cart 1 Position (cm)
1.5
1 1
1
0.5 0.5
0.5 Input
Output
0 0 0
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
4 4 0.2
Cart 1 Velocity (cm/sec)
0.15
Control Effort
2 2
0.1
0 0
0.05
-2 -2 0
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
Figure 6: State feedback control of a 2DOF rectilinear system with bad data
poles = -25 ,-20 ,-15 ,-10 ,-5 and K = 0.38, 0.021, -0.28, 0.01 , 0.51 Input/Output
1.5 1.5 1.5
Cart 1 Position (cm)
3 3 0.2
Cart 1 Velocity (cm/sec)
Control Effort
1 1 0.1
0 0 0.05
-1 -1 0
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
Figure 7: Improved state feedback control of a 2DOF rectilinear system with bad data
1. In this problem we will incorporate a full order observer for a one degree of freedom
system and run some test cases to verify your code is working. The full order observer state
variable feedback control scheme is shown in Figure 8.
observer state variable feedback in Figure 8. This modification includes breaking the
feedback from the output to the summer and inserting the observer. It also involves adding
three summers, the multiplier for the A, B, and C matrices for the observer, an integrator
and the gain, Ke. Add To Workspace blocks for the variables m_x1_hat and m_x1_dot_hat.
3. Copy the MATLAB file, Basic_1dof_State_Variable_Model_driver.m to the Lab 10 folder
and rename it, sv1_observer_driver.m. Modify sv1_observer_driver.m to implement the
full order observer state variable feedback in Figure 8. Set the correct saturation level for
the Model 210 and load the state_model_1dof_rect file. The prefilter gain should also be
set to Gpf = -1/(C*inv(A-B*K)*B);. Then find the observer feedback gains by using Ke
= place(A',C',10*p)';. Set all of the initial conditions for the state variable model and
observer to zero. Set the simulation to run the sv1_observer.mdl Simulink model. Finally,
modify sv1_observer_driver.m to plot each of the true and estimated states on the same
graph. See Figure 9 for an example of doing this.
4. Now verify that you have built the full order observer state feedback correctly by setting the
input to 1 cm, the final time to 1 second, the state feedback poles to p = [-10 -12] and the
observer to respond five times faster. You should get a graph similar to Figure 9.
1DOF full order observer, poles = -10 , -12 opoles = -50 , -60
1 5
True True
Estimated Estimated
0.8 4
Cart Velocity (cm/sec)
Cart Position (cm)
0.6 3
0.4 2
0.2 1
0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
5. Now we will try and observe what happens when there is a difference between our model
and the real system. Modify the observer subsystem in the model (.mdl) file, so the A matrix
in the observer is called AA. Just before you run the model file, enter the command
AA=A*1.5;. You should get results like those in Figure 10.
6. Change the observer poles so they are ten times further from the imaginary axis than the
state feedback poles (observer poles at 10*p). You should get the results shown in Figure
11. If you place the observer poles 50 times away from the state feedback poles, you get
the result in figure 12. Note that as the observer poles get further away, the estimates get
better. Be sure to set AA=A before you go on.
1DOF full order observer, poles = -10 , -12 opoles = -50 , -60
3 10
True True
Estimated Estimated
2.5 5
1 -10
0.5 -15
0 -20
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time (sec) time (sec)
Figure 10: Full order observer for a model error for 1DOF system
1DOF full order observer, poles = -10 , -12 opoles = -1e+002 , -1.2e+002
2.5 6
True True
Estimated 4 Estimated
2
2
Cart Velocity (cm/sec)
Cart Position (cm)
1.5
0
-2
1
-4
0.5
-6
0 -8
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time (sec) time (sec)
Figure 11: Full order observer for a model error for 1DOF system with 10x state feedback
poles
1DOF full order observer, poles = -10 , -12 opoles = -5e+002 , -6e+002
1.4 6
True True
1.2 5
Estimated Estimated
4
Cart Velocity (cm/sec)
1
Cart Position (cm)
3
0.8
2
0.6
1
0.4
0
0.2 -1
0 -2
0 0.5 1 0 0.5 1
time (sec) time (sec)
Figure 12: Full order observer for a model error for 1DOF system with 50x state feedback
poles
1. In this problem we will incorporate a full order observer for a two degree of freedom
system and run some test cases to verify your code is working.
2. Copy the Simulink file Basic_2dof_State_Variable_Model.mdl to the Lab 10 folder and
rename it, sv2_observer.mdl. Modify sv2_observer.mdl to implement full order observer
state feedback for a 2DOF system. This includes adding the observer A, B, C matrices, the
observer gain, an integrator and 2 summers. You should set the C matrices so that the
output and estimated output are the position of cart 2.
3. Copy your program Basic_2dof_State_Variable_Model_driver.m to the Lab 10 folder and
rename it, sv2_observer_driver.m. Modify sv2_observer_driver.m to implement state
variable feedback using integral control. This includes loading the state_model_2dof_rect
and setting the C matrix to read the cart 2 position and also setting Cy to track the cart 2
position. Adding the code to find the observer feedback gains and set the initial conditions
to zero. The prefilter gain should also be set to Gpf = -1/(Cy*inv(A-B*K)*B);. Make
sure to change the simulation to run sv2_observer. Finally, modify sv2_observer_driver.m
to plot each of the true and estimated states on the same graph. See Figure 13 for an
example.
4. For an input of 1 cm and a final time of 2.0 seconds, set both the state feedback and
observer poles to p = [-10, -12, -14, -16] with the input to the observer the position of the
second cart. You should get a graph like that in Figure 13.
poles = -10 ,-12 ,-14 ,-16 opoles = -10 ,-12 ,-14 ,-16
1.5 1
Cart 1 Position (cm)
1
0.5
0.5
True True
Estimated Estimated
0 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2
3 3
Cart 1 Velocity (cm/sec)
2 2
1 1
True True
Estimated Estimated
0 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2
5. Now we will try and observe what happens when there is a difference between our model
and the real system. Modify the observer system in the model (.mdl) file, so the A matrix is
called AA. Just before you simulate the model file, enter the command AA = A*1.01.
Note in Figure 14 that the estimated state for cart 1 is not as accurate and the system is
almost marginally stable.
6. Now place the state feedback poles at twice their original values (at 2*p), and change the
observer poles to be ten times their original values (10*p). You should get results like those
in Figure 15. Note that if we do not change the pole locations, we will get an unstable
system.
poles = -10 ,-12 ,-14 ,-16 opoles = -10 ,-12 ,-14 ,-16
1 1
Cart 1 Position (cm)
4 4
Cart 1 Velocity (cm/sec)
2 2
0 0
-2 True -2 True
Estimated Estimated
-4 -4
0 0.5 1 1.5 2 0 0.5 1 1.5 2
Figure 14: Full order observer for a 2DOF system with a bad model
poles = -20 ,-24 ,-28 ,-32 opoles = -100 ,-120 ,-140 ,-160
1.5 1.5
15 6
Cart 1 Velocity (cm/sec)
5 2
0 True 0 True
Estimated Estimated
-5 -2
0 0.5 1 1.5 2 0 0.5 1 1.5 2
Figure 15: Full order observer for a 2DOF system with a bad model
7. Before you go on, set AA = A, or change your model back to its original form. Note that with
the observers in the system, we do not have zero steady state error if we do not use the
prefilter to cancel out the error. However, this is not the ideal solution because feedback
control systems are very sensitive to parameter changes for blocks outside of the feedback
loop. An alternate solution would be to add an integrator or increase the system to Type 1
and this will be reviewed next.
1. In this problem we will incorporate a full order observer and an integrator for a one degree
of freedom system and run some test cases to verify your code is working.
2. Copy your program sv1_observer_driver.m to a new file sv1_observer_int_driver.m. Then
copy the Simulink file sv1_observer.mdl to sv1_observer_int.mdl. Modify these new files
to implement state variable feedback with an observer using integral control. The basic
control scheme is shown below in Figure 16. Note that the prefilter is not needed in order
to get zero steady state error anymore.
Figure 16: Full order observer state variable feedback structure with integral control.
3. For an input of 1 cm, a final time of 1 second, place the state feedback poles at ps = [ -
35, -20+10j, -20-10j] and observer poles at po = [-25 -30], you should get a graph
like that in Figure 17.
4. Now we will try and observe what happens when there is a difference between our model
and the real system. Modify the observer block in the model file, so the A matrix is called
AA. Just before you simulate the model file, enter the command AA = A*1.5. You should
get results like those in Figure 18.
1DOF Type 1 Full Order Observer poles = -35 ,-20+10i ,-20-10i, observer poles = -25, -30
1.4 8
True True
Estimated Estimated
7
1.2
1
5
Cart Velocity (cm/sec)
Cart Position (cm)
0.8 4
3
0.6
2
0.4
0.2
0
0 -1
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time (sec) time (sec)
Figure 17: Full order observer state variable feedback with integrator
1DOF Type 1 Full Order Observer poles = -35 ,-20+10i ,-20-10i, observer poles = -25, -30
1.6 15
True True
1.4 Estimated 10 Estimated
1.2 5
0.8 -5
0.6 -10
0.4 -15
0.2 -20
0 -25
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time (sec) time (sec)
Figure 18: Full order observer with integrator with a bad model
5. Now change the observer poles so they are 10 larger than before (10*po). You should get
results like those in Figure 19. Note that in both Figures 17 and 19, the steady state error is
zero, even if the observer is not converged. Make sure to let AA = A before you move on.
1DOF Type 1 Full Order Observer poles = -35 ,-20+10i ,-20-10i, observer poles = -250, -300
1 10
True True
0.9 Estimated Estimated
8
0.8
0.7
Cart Velocity (cm/sec)
6
Cart Position (cm)
0.6
0.5 4
0.4
2
0.3
0.2
0
0.1
0 -2
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
time (sec) time (sec)
Figure 19: Full order observer with integrator with a bad model
1. In this problem we will incorporate a full order observer and an integrator for a two degree
of freedom system and run some test cases to verify your code is working.
2. Copy your program sv2_observer_driver.m to a new file sv2_observer_int_driver.m, then
copy the Simulink file sv2_observer.mdl to sv2_observer_int.mdl. Modify these new files
to implement state variable feedback with an observer using integral control.
3. For an input of 1 cm, a final time of 2 seconds, set the state feedback poles at
ps = [-10, -12, -14, -16, -18], the observer poles at po = [-10 -12 -14 -16], the output of the
system is the position of the second cart and the input to the observer is the position of
both carts, you should get a graph like that in Figure 20.
4. Now we will try and observe what happens when there is a difference between our model
and the real system. Modify the observer block in the model file, so the A matrix is called
AA. Just before you run the model file, enter the command AA = A*1.1. You should get
results like those in Figure 21.
poles = -10 ,-12 ,-14 ,-16 ,-18 opoles = -10 ,-12 ,-14 ,-16
1.5 1
Cart 1 Position (cm)
3 3
Cart 1 Velocity (cm/sec)
Figure 20: State feedback, full order observer, and integral control for a 2DOF system
poles = -10 ,-12 ,-14 ,-16 ,-18 opoles = -10 ,-12 ,-14 ,-16
2 2
Cart 1 Position (cm)
1.5
1
1
0
0.5 True True
Estimated Estimated
0 -1
0 0.5 1 1.5 2 0 0.5 1 1.5 2
5 4
Cart 1 Velocity (cm/sec)
2
0
0
-5
True -2 True
Estimated Estimated
-10 -4
0 0.5 1 1.5 2 0 0.5 1 1.5 2
Figure 21: State feedback, full order observer, and integral control for the 2DOF system
with a bad model
5. Now change the observer poles to be 10 times larger than before (10*po). You should get
the figure like that in Figure 22.
6. Before you go on, set AA = A.
poles = -10 ,-12 ,-14 ,-16 ,-18 opoles = -100 ,-120 ,-140 ,-160
1.5 1
Cart 1 Position (cm)
3 3
Cart 1 Velocity (cm/sec)
0 -1
0 0.5 1 1.5 2 0 0.5 1 1.5 2
Figure 22: Using an observer to improve a Type 1 state feedback, full order observer for a
2DOF system with a bad model
You need to turn in all 19 of the graphs you produced and also the 3 2DOF SIMULINK models for
integral control, full order observer control and Type 1 full order observer. You can copy all of
these figures into a Word document and email it to your instructor. Make sure you have figure
captions or labels for each.
Theory:
Please review the lecture notes and study guide for the essential theory related to integral
control, state variable feedback control and observers.
Procedure:
For this lab, you will use integral control, state variable feedback control and observers to
design your 1DOF and 2DOF systems to have less than a 2 second settling time and less than a
15% overshoot. Select the state feedback controller gains and observer gains to meet this
design requirement. Typically, you should make the observer at least 2 to 10 times faster than
the state feedback controller. Try to limit the closed loop poles to values between -1 and -50.
If you hear a grinding noise from the ECP motors when you run the system, you should move
the closed loop poles closer to the origin. Lastly, verify that the controller effort does not
reach the limits.
A. File Setup
1. Create a folder under Documents\ECE320\<your initials>\Lab10
2. Copy all of your state variable models from Labs 2 and 3 to the folder created in step 1
3. Copy all of the files used and created in the prelab to the folder created in step 1
4. Copy the Model210_sv1.mdl from Lab 9 to the folder created in step 1 and rename it
Model210_observer_sv1.mdl. Edit this file to match the Simulink simulation file created in
the prelab for the 1DOF full order observer (sv1_observer.mdl) except the ECP model 210
yellow block replaces the A and B state matrices (simulated state model).
5. You may also need to copy any other required files from prior lab folders such as the ECP
reset model and the compare1.m file.
While it may seem easier to just copy and paste the yellow ECP block, this often leads to really
strange errors, so don’t do it!
Note: Be sure all initial estimates in your observers and integrators are set to zero before you try
and control the ECP systems, and all of your simulated system errors have been removed.
3. Modify the sv2_observer_driver.m to load the correct model for the 2DOF rectilinear
system. Assume the position of both carts is available to the observer and that we want to
control cart 2.
4. Design the system to satisfy the design requirements. Initially, place the observer and
closed loop poles at the same location and simulate the system with a state feedback
controller and a full order observer using sv2_observer.mdl. Verify that the controller
effort does not reach the limits. You may need to vary the location of the state feedback
and observer poles until you get a good response. Recall that you typically want the
observer to respond faster than the state variable feedback controller.
5. Once the design has been completed, use the driver (sv2_observer_driver.m) to use the
Type 1 full order observer to control the actual ECP system by simulating
Model210_observer_sv2.mdl
6. Compare the actual states (from the ECP system) and the estimated states (from the
observer implemented using the state model). You will have to modify compare1.m to do
this. Be sure to change the legend command and use different line types so the results will
be acceptable with black and white printers. Only plot until the system reaches steady state.
You will probably have a non-zero steady state error.
7. Include the graph from the comparison in your lab memo submission.
5. Compare the actual states (from the ECP system) and the estimated states (from the
observer implemented in the ECP system). You will have to modify compare1.m to do this.
Be sure to change the legend command and use different line types so the results will be
acceptable with black and white printers. Only plot until the system reaches steady state.
Your system should have a near zero steady state error.
6. Include the graph from the comparison in your lab memo submission.
Submission:
The lab memo will be due by 5 pm on the last day of finals week. At a minimum it should
include the following:
Typewritten, 12 point font
Date, To, From, Subject
Written initials beside your name(s)
Written in first person from you and your lab partner
Written with minimal spelling and grammar errors
Purpose, procedure, results and conclusions of the laboratory experiment
A detailed description of the system setup including number of carts, spring numbers
and types, number of masses and labels, include ECP system number
All required figures with number and caption and they should be referenced in the text
All required data in tables with error analysis referenced in the text, if necessary
The discussion should compare and contrast the full order observer and Type 1 full
order observer results for the 1DOF and 2DOF systems.
The discussion should also compare the results of the two 1DOF system responses
APPENDIX
Laplace Transform Review
Matlab Commands
CAB Appendix.docx
1 Table of Laplace Transforms
f (t) F (s)
δ(t) 1
u(t) 1
s
tu(t) 1
s2
tn−1 u(t) (n = 1, 2, 3...) 1
(n−1)! sn
tnu(t) (n = 1, 2, 3, ...) n!
sn+1
e−atu(t) 1
s+a
te−atu(t) 1
(s+a)2
1 tn−1e−atu(t) (n = 1, 2, 3, ...) 1
(n−1)! (s+a)n
tne−atu(t) (n = 1, 2, 3, ...) n!
(s+a)n+1
sin(bt)u(t) b
s2+b2
cos(bt)u(t) s
s2+b2
e−at sin(bt)u(t) b
(s+a)2+b2
(s+a)
e−at cos(bt)u(t) (s+a)2+b2
5
2 Laplace Transform Review
In this course we will be using Laplace transforms extensively. Although we do not often go
from the s-plane to the time domain, it is important to be able to do this and to understand
what is going on. In what follows is a brief review of some results with Laplace transforms.
where N (s) and D(s) are polynomials in s with no common factors. The roots of N (s) are the
zeros of the system, while the roots of D(s) are the poles of the system.
is proper if the degree of the polynomial N (s) is less than or equal to the degree of the poly-
nomial D(s). The transfer function H(s) is strictly proper if the degree of N (s) is less than
the degree of D(s).
L{h(t)} = H(s)
h(t) = L−1 {H(s)}
6
2.4 Partial Fractions with Distinct Poles
Let’s assume we have a transfer function
N (s) N (s) K(s + z1 )(s + z2 )...(s + zm )
H(s) = = =
D(S) D(s) (s + p1 )(s + p2 )...(s + pn )
where we assume m < n (this makes H(s) a strictly proper transfer function). The poles of
the system are at −p1 , −p2 , ... − pn and the zeros of the system are at −z1 , −z2 , ... − zm .
Since we have distinct poles, pi 6= pj for all i and j. Also, since we assumed N (s) and D(s) have
no common factors, we know that zi 6= pj for all i and j.
We would like to find the corresponding impulse response, h(t). To do this, we assume
N (s) 1 1 1
H(s) = = a1 + a2 + ... + an
D(s) s + p1 s + p2 s + pn
If we can find the ai , it will be easy to determine h(t) since the only inverse Laplace transform
1 1
we need is that of s+p , and we know (or can look up) s+p ↔ e−pt u(t). To find a1 , we first
multiply by (s + p1 ),
s + p1 s + p1
(s + p1 )H(s) = a1 + a2 + ... + an
s + p2 s + pn
and then let s → −p1 . Since the poles are all distinct, we will get
lim (s + p1 )H(s) = a1
s→−p1
lim (s + p2 )H(s) = a2
s→−p2
and in general
lim (s + pi )H(s) = ai
s→−pi
s+1
H(s) =
(s + 2)(s + 3)
and we want to determine h(t). Since the poles are distinct, we have
(s + 1) 1 1
H(s) = = a1 + a2
(s + 2)(s + 3) s+2 s+3
Then
(s + 1) (s + 1) −1
a1 = lim (s + 2) = lim = = −1
s→−2 (s + 2)(s + 3) s→−2 (s + 3) 1
7
and
(s + 1) (s + 1) −2
a2 = lim (s + 3) = lim = =2
s→−3 (s + 2)(s + 3) s→−3 (s + 2) −1
Then
1 1
H(s) = −1 +2
s+2 s+3
and hence
It is often unnecessary to write out all of the steps in the above example. In particular, when
we want to find ai we will always have a cancellation between (s + pi ) in the numerator with
the (s + pi ) in the denominator. Using this fact, when we want to find ai we can just ignore (or
cover up) the factor (s + pi ) in the denominator. For our example above, we then have
(s + 1) −1
a1 = lim = = −1
s→−2 (s + 3) 1
(s + 1) −2
a2 = lim = =2
s→−3 (s + 2) −1
s2 − s + 2
H(s) =
(s + 2)(s + 3)(s + 4)
and we want to determine h(t). Since the poles are distinct, we have
(s2 − s + 2) 1 1 1
H(s) = = a1 + a2 + a3
(s + 2)(s + 3)(s + 4) s+2 s+3 s+4
(s2 − s + 2) 8
a1 = lim = =4
s→−2 (s + 3)(s + 4) (1)(2)
(s2 − s + 2) 14
a2 = lim = = −14
s→−3 (s + 2) (s + 4) (−1)(1)
(s2 − s + 2) 22
a3 = lim = = 11
s→−4 (s + 2)(s + 3) (−2)(−1)
and hence
8
Example 3. Let’s assume we have
1
H(s) =
(s + 1)(s + 5)
and we want to determine h(t). Since the poles are distinct, we have
1 1 1
H(s) = = a1 + a2
(s + 1)(s + 5) s+1 s+5
and hence
1 −t 1
h(t) = e u(t) − e−5t u(t)
4 4
Although we have only examined real poles, this method is also valid for complex poles, although
there are usually easier ways to deal with complex poles, as we’ll see.
9
2.5 Partial Fractions with Distinct and Repeated Poles
Whenever there are repeated poles, we need to use a different form for the partial fractions for
those poles. This is probably most easily explained by means of examples.
Now we need to be able to determine the expansion coefficients. We already know how to do
this for distinct poles, so we do those first.
For Example 4,
1 1
a1 = lim 2
= =1
s→−1 (s + 2) 1
For Example 5,
s+1 −1 1
a3 = lim = =−
s→−2 s2(s + 3) 2
(−2) (1) 4
s+1 −2 2
a4 = lim 2 = 2
=
s→−3 s (s + 2) (−3) (−1) 9
The next set of expansion coefficients to determine are those with the highest power of the
repeated poles.
10
or with the coverup method
1 1
a3 = lim = = −1
s→−2 (s + 1) −1
For Example 5, multiply though by s2 and let s → 0
s+1 s+1 1
a2 = lim s2 = lim =
s→0 s2 (s + 2)(s + 3) s→0 (s + 2)(s + 3) 6
or with the coverup method
s+1 1 1
a2 = lim = =
s→0 (s + 2)(s + 3) 6 6
So far we have:
for Example 4
1 1 1 1
2
= + a2 −
(s + 1)(s + 2) s+1 s + 2 (s + 2)2
and for Example 5
s+1 1 11 1 1 2 1
= a1 + 2 − +
s2 (s + 2)(s + 3) s 6s 4s+2 9s+3
We now need to determine any remaining coefficients. There are two common ways of doing
this, both of which are based on the fact that both sides of the equation must be equal for any
value of s. The two methods are
1. Multiply both sides of the equation by s and let s → ∞. If this works it is usually very
quick.
2. Select convenient values of s and evaluate both sides of the equation for these values of s
For Example 4, using Method 1,
" # " #
1 s s s
lim s = lim + a2 −
s→∞ (s + 1)(s + 2)2 s→∞ s + 1 s + 2 (s + 2)2
or
0 = 1 + a2 + 0
so a2 = -1.
11
or
1 2
0 = a1 + 0 − +
4 9
1 2 1
so a1 = 4
− 9
= 36
For Example 4, using Method 2, let’s choose s = 0 (note both sides of the equation must be
finite!)
" # " #
1 1 1 1
lim = lim + a2 −
s→0 (s + 1)(s + 2)2 s→0 s + 1 s + 2 (s + 2)2
or
1 a2 1
= 1+ −
4 2 4
so a2 = 2( 14 + 14 − 1) = −1
For Example 5, using Method 2, let’s choose s = −1 (note that s = 0, s = −2, or s = −3 will
not work)
" # · ¸
s+1 1 11 1 1 2 1
lim 2
= lim a1 + 2 − +
s→−1 s (s + 2)(s + 3) s→−1 s 6s 4s+2 9s+3
or
1 11
0 = −a1 + −
6 49
1
so a1 = 6
− 14 + 1
9
= 1
36
1 1 1 2
h(t) = u(t) + tu(t) − e−2t u(t) + e−3t u(t)
36 6 4 9
In summary, for repeated and distinct poles, go through the following steps:
1. Determine the form of the partial fraction expansion. There must be as many unknowns
as the highest power of s in the denominator.
2. Determine the coefficients associated with the distinct poles using the coverup method.
3. Determine the coefficient associated with the highest power of a repeated pole using the
coverup method.
12
4. Determine the remaining coefficients by
Example 6. Assuming
s2
H(s) =
(s + 1)2 (s + 3)
determine the corresponding impulse response h(t).
(s2 ) 9
a3 = lim =
s→−3 (s + 1)2 4
Third, we determine the coefficient(s) of the highest power of the repeated pole(s)
(s2 ) 1
a2 = lim =
s→−1 (s + 3) 2
Fourth, we determine any remaining coefficients
" # " #
s2 s 1 s 9 s
lim s = lim a1 + +
s→∞ (s + 1)2 (s + 3) s→∞ s + 1 2 (s + 1) 2 4 (s + 3)
or
9
1 = a1 + 0 +
4
9
or a1 = 1 − 4
= − 54 .
13
First we determine the correct form
s+3 1 1 1 1 1
H(s) = = a1 + a2 + a 3 + a4 + a5
s(s + 1)2 (s + 2)2 s s+1 (s + 1)2 s+2 (s + 2)2
Third, we determine the coefficient(s) of the highest power of the repeated pole(s)
s+3 2
a3 = lim 2
= = −2
s→−1 s (s + 2) (−1)(1)
s+3 1 1
a5 = lim = = −
s→−2 s(s + 1)2 (−2)(1) 2
or
3
0 = + a2 + a4
4
We need one more equation, so let’s set s = −3
" # " #
s+3 31 1 1 1 1 1
lim = lim + a2 −2 + a4 −
s→−3 s(s + 1)2 (s + 2)2 s→−3 8s s+1 (s + 1) 2 s + 2 2 (s + 2)2
or
1 1 1 1
0 = − − a2 − − a4 −
4 2 2 2
This gives us the set of equations
" #" # " #
−3
1 1 a2
1 = 4
5
2
−1 a4 4
3 −7 −2t 1
h(t) = u(t) + e−t u(t) − 2te−t u(t) + e u(t) − te−2t u(t)
4 4 2
14
2.6 Complex Conjugate Poles: Completing the Square
Before using partial fractions on systems with complex conjugate poles, we need to review one
property of Laplace transforms:
Then
Z ∞ Z ∞
−at −at −st
L{e x(t)} = e x(t)e dt = x(t)e−(s+a)t dt = X(s + a)
0 0
The other relationships we need are the Laplace transform pairs for sines and cosines
s
cos(bt)u(t) ⇔
s2 + b2
b
sin(bt)u(t) ⇔ 2
s + b2
Finally, we need to put these together, to get the Laplace transform pair:
s+a
e−at cos(bt)u(t) ⇔
(s + a)2 + b2
b
e−at sin(bt)u(t) ⇔
(s + a)2 + b2
Complex poles always result in sines and cosines. We will be trying to make terms with complex
poles look like these terms by completing the square in the denominator.
In order to get the denominators in the correct form when we have complex poles, we need to
complete the square in the denominator. That is, we need to be able to write the denominator
as
D(s) = (s + a)2 + b2
To do this, we always first find a using the fact that the coefficient of s will be 2a. Then we use
whatever is needed to construct b. A few example will hopefully make this clear.
D(s) = s2 + s + 2
and we want to write this in the correct form. First we recognize that the coefficient of s is 1,
so we know 2a = 1 or a = 21 . We then have
1
D(s) = s2 + s + 2 = (s + )2 + b2
2
15
To find b we expand the right hand side of the above equations and then equate powers of s:
1 1
D(s) = s2 + s + 2 = (s + )2 + b2 = s2 + s + + b2
2 4
√
clearly 2 = b2 + 14 , or b2 = 47 , or b = 2
7
. Hence we have
à √ !2
1 7
D(s) = s2 + s + 2 = (s + )2 +
2 2
D(s) = s2 + 3s + 5
and we want to write this in the correct form. First we recognize that the coefficient of s is 3,
so we know 2a = 3 or a = 23 . We then have
3
D(s) = s2 + 3s + 5 = (s + )2 + b2
2
To find b we expand the right hand side of the above equations and then equate powers of s:
3 9
D(s) = s2 + 3s + 5 = (s + )2 + b2 = s2 + 3s + + b2
2 4
√
clearly 5 = b2 + 94 , or b2 = 11
4
, or b = 11
2
. Hence we have
Ã√ !2
3 11
D(s) = s + 3s + 5 = (s + )2 +
2
2 2
Now that we know how to complete the square in the denominator, we are ready to look at
complex poles. We will start with two simple examples, and then explain how to deal with more
complicated examples.
1
H(s) =
s2 + s + 2
and we want to find the corresponding impulse response h(t). In this simple case, we first
complete the square, as we have done above, to write
1
H(s) = ³ √ ´2
(s + 12 )2 + 2
7
16
This almost has the form we want, which is
b
e−at sin(bt)u(t) ⇔
(s + a)2 + b2
However, to use
√ this form we need b in the numerator. To achieve this we will multiply and
divide by b = 27
1
H(s) = ³ √ ´2
(s + 12 )2 + 2
7
√
7
1 2
= √
7
³ √ ´2
2 (s + 12 )2 + 7
2
or
√
2 −1t 7
h(t) = √ e 2 sin( t)u(t)
7 2
Example 11. Assuming
s
H(s) =
s2 + 3s + 5
and we want to find the corresponding impulse response h(t). In this simple case, we first
complete the square, as we have done above, to write
s
H(s) = ³ √ ´2
(s + 32 )2 + 11
2
(s + a)
e−at cos(bt)u(t) ⇔
(s + a)2 + b2
However, to use this form we need s + a in the numerator, not just s To achieve this we will
add and subtract a = 23 in the numerator
s + 32 − 3
2
H(s) = ³√ ´2
(s + 32 )2 + 11
2
3 3
s+ 2 2
= ³ √ ´2 − ³ √ ´2
(s + 32 )2 + 11
2
(s + 32 )2 + 11
2
The first term is now what we want, and will produce a term of the form
√
− 32 t 11
e cos( t)u(t)
2
17
The second term needs some work. It looks like a sine times a decaying exponential, but √ the
scaling is wrong. Again, to put this term in the correct form we will multiply and divide by 211
√
3 11
s+ 3 12 2
H(s) = ³ √ ´2 − √11 ³ √ ´2
(s + 12 )2 + 211 2 (s + 1 2
) + 11
2 2 2
which gives
√ √
− 32 t 11 3 −3t 11
h(t) = e cos( t)u(t) − √ e 2 sin( t)u(t)
2 11 2
Note that it is possible to combine the sine and cosine terms into a single cosine with a phase
angle, but we will not pursue that here.
The examples we have done so far only contain complex roots. In general, we need to be able
to deal with systems that have both complex and real roots. Since we are dealing with real
systems in this course, all complex poles will occur in complex conjugate pairs. Hence, when we
have complex poles, we will look for quadratic factors of the general form
cs + d
s2 + +es + d
Note that there are two unknown coefficients in this term. Since we need as many unknowns
as the highest power of s in the denominator, and this term has 2 powers of s, we need two
unknowns. We are now ready to do one more example.
1
H(s) =
(s + 2)(s2 + s + 1)
and we want to determine the corresponding impulse response h(t). First we need to find the
correct form for the partial fractions
1 1 a2 s + a3
H(s) = 2
= a1 + 2
(s + 2)(s + s + 1) s+2 s +s+1
Note that we have three unknowns since the highest power of s in the denominator is 3. Since
there is an isolated pole at -2, we find coefficient a1 first using the coverup method
1 1 1
a1 = lim = =
s→−2 (s2+ s + 1) 2
(−2) + (−2) + 1 3
18
or
1
0 = + a2
3
so a2 = − 13 . Now we have to find a3 and the only trick we have left is choosing a value of s. For
this particular transfer function, s = 0 is a good choice
" # · ¸
1 1 1 a2 s + a3
lim = lim + 2
s→0 (s + 2)(s2 + s + 1) s→0 3 s + 2 s +s+1
or
1 1
= + a3
2 6
or a3 = 13 . So far we have
1 1 − 1 s + 13
H(s) = + 23
3s+2 s +s+1
The first term is easy, now we need to work on the second term. First we complete the square
in the denominator
à √ !2
2 1 2 3
s + s + 1 = (s + ) +
2 2
so we have
1 1 − 13 s + 13
H(s) = + ³√ ´
3 s + 2 (s + 1 )2 + 3 2
2 2
The next thing to do is to add and subtract 12 , so the numerator has the correct form so we have
1 1 − 1 (s + 12 − 21 ) + 31
H(s) = + 3 ³ √ ´2
3s+2 (s + 12 )2 + 23
1 1 − 1 (s + 12 ) + ( 16 + 13 )
= + 3 ³ √ ´2
3s+2 (s + 12 )2 + 23
1 1 − 13 (s + 12 ) + 12
= + ³√ ´
3 s + 2 (s + 1 )2 + 3 2
2 2
1 1 1 (s + 12 ) 1 1
= − ³ √ ´2 + ³√ ´
3 s + 2 3 (s + 1 )2 + 3 2 (s + 1 )2 + 3 2
2 2 2 2
Finally, we have to scale the final term to put it into the correct form
√
1 1 1 (s + 12 ) 1 1 2
3
H(s) = − ³ √ ´2 + √3 ³ √ ´2
3 s + 2 3 (s + 1 )2 + 3 2 (s + 1 2
) + 3
2 2 2 2 2
√
1 1 1 (s + 12 ) 1 2
3
= − ³√ ´ + √ ³√ ´
3 s + 2 3 (s + 1 )2 + 3 2 3 (s + 1 )2 + 3 2
2 2 2 2
19
So we finally have
√ √
1 −2t 1 −1t 3 1 −1t 3
h(t) = e u(t) − e 2 cos( t)u(t) + √ e 2 sin( t)u(t)
3 3 2 3 2
b
H(s) =
s2 + cs + d
and we want to find the step response of this system,
1
Y (s) = H(s)
s
b 1 a2 s + a3
= = a1 + 2
s(s2
+ bs + c) s s + bs + c
b a1 (s2 + bs + c) + s(a2 s + a3 )
= =
s(s2 + bs + c) s(s2 + bs + c)
b (a1 c)s0 + (a1 b + a3 )s1 + (a1 + a2 )s2
= =
s(s2 + bs + c) s(s2 + bs + c)
Since we have made the denominator common for both sides, we just need to equate powers of
s in the numerator:
a1 c = b
a1 b + a3 = 0
a1 + a2 = 0
Since c and b are known, we can easily solve for a1 in the first equation, then a2 and a3 in the
remaining equations.
1
H(s) =
s2 + 2s + 2
using the common denominator method. Y (s) is given by
1 1 1 a2 s + a3
Y (s) = 2
= a1 + 2
s s + 2s + 2 s s + 2s + 2
20
If we put everything over a common denominator we will have the equation
1 = a1 (s2 + 2s + 2) + s(a2 s + a3 )
= (2a1 )s0 + (2a1 + a3 )s1 + (a1 + a2 )s2
Equating powers of s we get a1 = 12 , then a3 = −1 and a2 = − 21 . The we have
−1
11 s−1
Y (s) = + 22
2 s s + 2s + 2
11 1 s+2
= −
2 s 2 s2 + 2s + 2
1 1 1 (s + 1) 1 1
= − −
2 s 2 (s + 1)2 + 1 2 (s + 1)2 + 1
In the time-domain we have then
1 1 1
y(t) = u(t) − e−t cos(t)u(t) − e−t sin(t)u(t)
2 2 2
Example 15. Find the step response of
3
H(s) =
2s2
+ 3s + 3
using the common denominator method. Partial fractions will only work if the denominator is
monic, which means the leading coefficient must be a 1. Hence we rewrite H(s) as
3
2
H(s) = 3 3
s2 + 2
s + 2
Y (s) is then given by
3
1 2 1 a2 s + a3
Y (s) = = a1 + 2 3
s s2 + 32 s + 3
2
s s + 2 s + 32
If we put everything over a common denominator we will have the equation
3 3 3
= a1 (s2 + s + ) + s(a2 s + a3 )
2 2 2
3 3
= ( a1 )s0 + ( a1 + a3 )s1 + (a1 + a2 )s2
2 2
Equating powers of s we get a1 = 1, then a2 = −1 and a3 = − 32 . The we have
1 −s − 3
Y (s) = + 2 3 2 3
s s + 2s + 2
1 s+ 3 + 3
= − 2 34 4 3
s s + 2s + 2
s q
3 15
1 (s + 4
)3 16 16
= − ³q ´2 − ³q ´
s (s + 3 )2 + 15 4 15 (s + )2 +
3 15
4 16 4 16
21
2.8 Complex Conjugate Poles-Again
It is very important to understand the basic structure of complex conjugate poles. For a system
with complex poles at −a±bj, the characteristic equation (denominator of the transfer function)
will be
We know that this form leads to terms of the form e−at cos(bt)u(t) and e−at sin(bt)u(t). Hence
we have the general relationship that complex poles at −a ± jb lead to time domain functions
that
• decay like e−at (the real part determines the decay rate)
• oscillate like cos(bt) or sin(bt) (the imaginary part determines the oscillation frequency)
These relationships, relating the imaginary and real parts of the poles with corresponding time
domain functions, are very important to remember.
22
A Matlab Commands
In this section I have listed some common Matlab commands and sections of code that you will
be using on the homework problems. You will probably want to use the help, doc, and lookfor
commands to learn more about theses various functions and commands as you go on though
this course. We will only go over some very simple uses of the commands here.
A.1 Figures
The first time you tell Matlab to plot something, it opens a new window and produces a graph.
Matlab’s default is to plot each graph in the same window, overwriting the previous graph. The
figure command is given before plotting a new graph to tell Matlab to open a new window for
a new graph.
poly = [a b c d e];
where the powers are implied, only the coefficients are entered. (The semicolon at the end tell
Matlab not to regurgitate what you just told it.) Hence, if we have a rational transfer function,
such as
s3 + 2s
H(s) =
s4 + 3s3 + s + 5
we can enter the numerator and denominator polynomials separately, as
We will usually need to construct the transfer functions explicitly. To do this, type
H = tf(num,den)
This, without the semicolons, should display the transfer function, so you can check that you
entered the correct function. In fact, at any time you can just type H to have Matlab display
what the transfer function is.
i
A.3 Feedback Systems
Let’s assume we want to find the closed loop transfer function for the following system using
Matlab,
R(s) s+1 ²¯
10 s2 +2
Y (s)
- -+ - - -
s2 +2s+3 -
±° s s3 +2s2 +1
6
1 ¾
s+1
ii
which is initially at rest (the initial conditions are 0) to an input of cos(3t) from 0 to 100 seconds
in increments of 0.05 seconds and then plots the output.
We can (obviously) use the lsim command to determine the step response,
The following piece of code will plot the step response of system H, showing both the system
response and the input (we generally want the system to track the input), with neat labelling.
%
% The Step Response
%
t = [0:0.1:10]; % time from 0 to 10 in increments of 0.1
u = ones(1,length(t)); % the input is a sequence of 1’s
y = lsim(H,u,t); % sumulate the friggin system
figure; % set up a new figure (window)
plot(t,y,’-’,t,u,’.-’); % plot the system response/input on one graph
grid; % put on a grid;
title(’Step Response of H’); % put on a title
xlabel(’Time (Seconds)’); % put on an x axis label
legend(’Step Response’,’Unit Step’); % put on a legend
%
% Now do line thickness
%
figure;
hold on % this basically means everything else is on one graph
plot(t,y,’-’,’Linewidth’,4); % make the linewidth 4 (really quite large)
iii
plot(t,u,’-’,’Linewidth’,0.2); % make the linewidth 0.2 (really quite small)
legend(’output’,’input’); grid;
hold off % we are done with this graph
%
You should note that even though you are changing the line width, you can still chose both the
type of line to draw (dashed, dotted, etc) and the color. Also, this may not look so good on the
screen, but usually prints out much better with a reasonable quality printer. Also, sometimes
hold on and hold off can act really weird when you are doing many graphs. This is particularly
true if you forgot the hold off.
the poles of the system are at -2 (repeated), -3, and -4 while the zeros of the system are at -1,
+1 (and ∞, but we don’t usually talk about this). The poles of the transfer function are the
same as the eigenvalues of the system. We care about the poles of the system since they indicate
how fast the system will respond and the bandwidth of the system. The commands pole(G)
and zero(G) will return the poles and zeros of transfer function G.
r = roots(Q);
For example, if Q(s) = s3 + s + 1 and we wanted the roots of Q(s), we would type
Q = [1 0 1 1];
r = roots(Q);
r =
0.3412 + 1.1615i
0.3412 - 1.1615i
-0.6823
If we wanted to determine the polynomial with roots at 0.3412 ± 1.1615j, −0.6823 we would use
the poly command
iv
or, in our case
Q = poly(r);
or
If we want to polynomial with roots at 0.3412 ± 1.1615j, −0.6823 we can just type
rlocus(H);
You will be able to click on a line and determine both the value of the gain K at that point
and the corresponding closed loop pole values. If we want to know the values of the closed loop
poles at a particular value of K, say K = 10, we type
r = rlocus(H,10)
margin(H)
To create the bode plot of a system with open loop transfer function H(s), we use the bode
command
bode(H)
There are a number of useful variations on the bode command. For example, if we want to view
to bode plot over a specified range of frequencies, we type
Sometimes we want the magnitude and phase of the transfer function H(s). We can use the
command
[Mag,Phase,w] = bode(H);
Mag = Mag(:);
Phase = Phase(:);
v
In this command, Matlab returns the magnitude (not in dB), phase,and frequencies the function
was evaluated at, but the magnitude and phase are stored in a weird way. The command
M ag = M ag(:) forces Matlab to put them in a column. We can also specify which frequencies
we want to evaluate the function at
[Mag,Phase] = bode(H,w);
If we then want to just plot the magnitude of the transfer function we can use
Mag = Mag(:);
Mag_dB = 20*log10(Mag);
semilogx(w,Mag_dB); grid;
vi
ECE 320 Linear Control Systems Fall 2010 - 11
Formula Sheet
Time Response
( )
First-order system ( )
( )
Second-order system ( )
rise time
settling time
peak time √
percent overshoot √
( ⁄ )
damping ratio
√ ( ⁄ )
Steady-State Error
step ( )
ramp ( )
parabola ( )
magnitude criterion | ( ) ( )|
angle criterion ( ) ( ) ( ) , k = 0, 1, 2, …
( )
asymptotic angles
= n – m = # of poles - # of zeros
∑ ∑
Centroid of the asymptotes
Frequency Response
sensitivity ( ) | |
bandwidth √ √
( )( )
PID Controller ( )
( )
PI Controller ( ) ⁄
PD Controller ( ) ( )
phase margin
√ √
⁄
( ) ( ) ( )
Lag compensator ⁄( )
Lead compensator ⁄
( ) ( ) ( )
⁄( )
Lag-Lead compensator ⁄ ⁄
( )( )
⁄( ) ⁄( )
0< < 1, > 1, = 1/
At -1 -1
state transition or fundamental matrix (t) = e = L ([sI – A] )
( )
() ( ) ∫ ( )
solution to the state equations
-1 -1
X(s) = [sI-A] x(0) + [sI-A] BU(s)
( )
Transfer Function ( ) ( ) B+D
( )
̇ ( )
State feedback
y = Cx
̇
[ ̇] [ ][ ] [ ]
̂ ̂
[ ][ ]
̂
Observer feedback
̇
[ ̇] [ ][ ] [ ]
̃ ̃
[ ][ ]
̃
̇ = -Cx + r
Integral state-feedback control
̇
[ ] [ ][ ] [ ]
̇
̇
[ ̇] [ ][ ]
̂ ̂
Integrated state variable feedback with full order
̇
observer [ ̇] [ ][ ]
̃ ̃
Observability Matrix [ ]