Sunteți pe pagina 1din 262

ECE 320 Linear Control Systems

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.

What is expected of You


First and foremost, professional work is the norm in this course. All of your written work and
your conduct in class are to be at the level of one who is studying a profession—the profession
of engineering. This means a number of things:
1. Your work is neatly done in a professional manner, using formats specified.

CAB ECE320_Syllabus Page 1 of 4


ROSE-HULMAN INSTITUTE OF TECHNOLOGY
ECE 320 Linear Control Systems Winter 2010 - 2011
2. Your work is honestly done. You are encouraged to discuss course material with
classmates to help each other understand and assimilate the concepts. Nevertheless,
distinguish between helping someone understand concepts and providing them with
specific answers. You are expected to work individually on homework without
reference to others’ work.
3. Your work is done on time. As a rule of thumb, expect to put in eight hours per week
outside of class doing homework, reading the text, and studying.
4. You are attentive and engaged in the lecture (i.e. not sleeping, reading the newspaper,
surfing the web, doing homework for other courses, disturbing others with electronics).
Grading:
Grades will be assigned at the end of the quarter based on the grade weights and grading scale
shown below:
Midterms 39% A 90 – 100
Final Exam 26% B+ 85 – 89
Homework 10% B 80 - 84
Labs and Memos 15% C+ 75 - 79
Lab Practical Test 5% C 70 - 74
Quizzes 5% D+ 65 - 69
D 60 - 64
F Below 60
Independent of point totals:
 You must satisfactorily complete all of the lab projects in order to pass the course
 You must have a passing weighted exam average of greater than or equal to 60% in order to
pass the course.
Examinations:
In this course, examinations make up 70% of the grade and warrant careful preparation.
Examination questions will be based on the lecture material, homework, quizzes and laboratory
work. Midterm tests will be fifty minutes in duration during the regular class meeting time.
Midterms and final examinations will be closed book and closed notes. You will be provided
with a formula sheet. It is your responsibility to memorize or derive any formula missing from
this document.

CAB ECE320_Syllabus Page 2 of 4


ROSE-HULMAN INSTITUTE OF TECHNOLOGY
ECE 320 Linear Control Systems Winter 2010 - 2011
Homework:
The homework is intended to help you to understand the concepts presented in the course,
and to provide you with practice in problem solving. Each student should complete the
homework on engineering paper.
 Problem sets are due each Tuesday at the beginning of class before the bell rings.
 Homework turned in after the bell rings is late and will incur a 20% penalty.
 Homework turned in after 5 pm on the due date will not be accepted.
 Arrange to turn in homework early if you will be away for job interviews, athletic events,
etc.
Pre-labs:
Pre-labs are intended to help you understand the purpose and theory of the weekly laboratory
assignments. Each student should complete the pre-lab on engineering paper.
 Pre-lab exercises are due each Thursday at the beginning of class before the bell rings.
 Pre-labs submitted after the bell rings are late and will incur a 20% penalty
 Any student that has not completed the pre-lab, must do it at the beginning of lab for zero
credit. Although the pre-lab must be completed, the team is still responsible for finishing
the laboratory assignment within the allotted time.
Lab memos:
The lab memo will be used to present the purpose, theory, procedure, results and conclusions
of the weekly laboratory assignments. Each student must submit a typewritten lab memo.
 Lab memos will be due one week from the completion of the laboratory assignment at
the beginning of class before the bell rings.
 Memos submitted after the bell rings will incur a 20% penalty.
 Memos submitted after 5 pm on the due date will not be accepted.
 Recall that students are required to complete all lab assignments in order to pass the
course. If a lab is made up without an excused absence, the memo will be checked for
completion although the grade will remain a zero.
Quizzes:
There will be weekly quizzes that involve solving short problems or answering questions on
lecture material and homework. The purposes for these quizzes are:
 to give me feedback on the current level of understanding of the class
 to give you feedback on your current level of understanding
 to give you practice on problems similar to the exam format
 to encourage collaborative learning in the classroom

CAB ECE320_Syllabus Page 3 of 4


ROSE-HULMAN INSTITUTE OF TECHNOLOGY
ECE 320 Linear Control Systems Winter 2010 - 2011
 to also take attendance
Re-grades:
All requests for re-grades must be made in writing within one week of the return of the
assignment or exam. The student should not make any marks on the document and must
attach a memorandum that details a technical justification for the reason for the submission. It
should be noted that based upon the request, the grade may increase, decrease or remain the
same.
Attendance:
Regardless of whether formal attendance is taken, attendance at each class is expected. As a
rule of thumb you should consider yourself seriously behind if you miss more than four classes
in a four credit-hour course. According to our Academic Rules and Procedures, “A student
whose total absences in a course, excused or unexcused, exceed two per credit is liable to fail
the course.” Eight absences in this course are grounds for failure. Missing an attendance check
due to lateness may be counted as an absence.
If you miss a lab with an excused absence you need to make it up within 1 week without
penalty. If you miss a lab without an excused absence, you need to make it up within 1 week
and you will receive a grade of zero. If you come to lab more than 15 minutes late you need to
complete the lab on your own.
Missed exams will not be made up. The final exam grade will be used to replace a missing test
grade in the case of excused absences. Excused absence from an examination normally
requires advance approval or formal documentation of an emergency. An examination that is
missed for an unexcused reason will be given a grade of zero. Students are not excused from
scheduled exams for intramural athletics or fraternity events.
Calculators & Computers:
You will need a calculator that can perform arithmetic with complex numbers (TI-83 plus or
better). You are encouraged to practice doing the homework with the same calculator you will
use on the exam. It is important to learn to do complex number and simultaneous equations
(or matrix) calculations with your calculator to be successful in this course. Maple can be used
on the homework problems, but not in the exams.
Academic accommodation:
Those students with documented special needs may request extra time on timed tests.
Students need to contact me at least 2 business days prior to each exam to make the necessary
arrangements.

CAB ECE320_Syllabus Page 4 of 4


ECE 320
Concept Map
Introduction
Closed-loop vs. Open loop
Control

Models of Physical Systems


Electrical, Mechanical

Transfer Block State-Space


functions Diagrams Representation

Analysis

Transient Steady-State Frequency

Stability (Routh-Hurwitz), Steady-State Error, Sensitivity, Root Locus, Peak time,


Settling time, Rise time, Percent Overshoot, Nyquist Criterion, Gain and Phase Margin

Design

Lag-Lead Root Pole-Zero Frequency


State-Space
Locus Placement Response

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 

CAB ECE 320 HWK1.docx Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB ECE 320 HWK1.docx Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

8. Use the [zeros,poles]=tf2zp(num,den) command in MATLAB to find the poles


and zeros for the 3 transfer functions in problem 4. Alternately you can use the
pole(tf(num,den)) and zero(tf(num,den)) commands to find the poles and
zeros.
9. Use the pzmap(tf(num,den)) command in MATLAB to create a plot of the pole-zero
locations in the complex s-plane for the transfer function, H(s), in problem 4 for the 3
resistor values. You have the option of putting all 3 plots on the same figure by using the
pzmap(sys1,'r',sys2,'g',sys3,'b') MATLAB command and the
legend('sys1 red','sys1 green', 'sys3 blue') MATLAB command to
show the legend.
10. Use the lsim(sys,u,t)MATLAB command to plot the step response for the three
transfer functions in problem 4. You have the option of putting all 3 plots on the same
figure by using the lsim(sys1,'-',sys2,'-.', sys3,'--',u,t); and
legend('sys1 -','sys2 -.','sys3 --'); MATLAB commands. Alternately,
you can use step(sys1) or [y,t]=step(sys1,t).

CAB ECE 320 HWK1.docx Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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).

ECE 320 HWK 2.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 2.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

series sys1 = tf(num1,den1);


sys2 = tf(num2,den2); sys1 sys2
sys = series(sys1, sys2):

parallel sys = parallel(sys1, -sys2);

(difference)
sys1 +
_
sys2

feedback sys = feedback(sys1, sys2, -1)


+ sys1
(negative) _

sys2

pole-zero sys_min = minreal(sys);

cancellation

ECE 320 HWK 2.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

Homework 3
Lectures 2-3 through 3-2
State equations solutions and transfer functions
Transient and Steady-State Response Analysis

1. Consider the system described by the following transfer function


( )
( )
( )
a. determine the state transition matrix, (t) = eAt = L-1([sI – A]-1)
b. assume that the initial conditions are zero and the input is a unit step function, find the
solution x(t) and the output y(t).
c. assume that the input is zero and the initial conditions are x1 = 1 and x2 = 1, find the
solution x(t) and the output y(t).
2. Convert the state and output equations for the following system to a transfer function.

̇ [ ] [ ] ( )

[ ]
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,

pole, rise time and settling time.


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.
( )
( )
( )

ECE 320 HWK 3.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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);

ECE 320 HWK 3.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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));

ECE 320 HWK 3.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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 jaxis

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.

R(s) + K(s + 20)


Y(s)
_ (s3 + 5s2 + 6s)

4. Use the Routh-Hurwitz criterion to determine if the following characteristic equation


describes a stable system. If the system is unstable, state the number of poles in the RHP,
LHP and on the jaxis.
4 3 2
(s) = 2s + 3s + 30s + 30s + 200

5. Use the Routh-Hurwitz criterion to determine if the following characteristic equation


describes a stable system. If the system is unstable, state the number of poles in the RHP,
LHP and on the jaxis.
(s) = s7 + 3s6 + 3s5 + s4 + s3 + 3s2 + 3s + 1

ECE 320 HWK 4.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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 jaxis.

̇ [ ] [ ]

[ ]
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

K = [1:2000]; %define the range of K values to check


for n = 1:length(K);
den = [1 18 77 K(n)]; %define the denominator of T(s)
poles=roots(den); %calculate teh poles of T(s) for each value of K
r = real(poles); %create a vector of the real parts of the poles
if max(r)>=0; %find the first set of poles with a positive real
part
K_max=K(n)-1 %print maximum value of K
break;
end
end

ECE 320 HWK 4.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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');

ECE 320 HWK 4.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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).

Input 100(s+2)(s+6) Output


+_
R(s) s(s+3)(s+4) Y(s)

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.

Input K(s+5) Output


+_
R(s) s(s+6)(s+7)(s+8) Y(s)

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.
( )
( )
( )( )

ECE 320 HWK 5.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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

For each figure determine the


a) position, velocity, acceleration error constants
b) steady state error
c) value of kp
d) value of ki

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)

ECE 320 HWK 5.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 5.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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

ECE 320 HWK 6.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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)

6. Sketch the root locus for the following control system.


Gc(s) Gp(s)
error 1
Input +_ K Output
R(s) s2 + 7s + 10
Y(s)

7. Sketch the root locus for the following control system.


Gc(s) Gp(s)
error s+1
Input +_ K Output
R(s) s2 + 10s + 24
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

ECE 320 HWK 6.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 6.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 7.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

( )
6. 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 for = 0.707.

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.

ECE 320 HWK 7.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 7.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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

-3, -4 and -20.

ECE 320 HWK 8.docx CAB Page 1 of 2


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 8.docx CAB Page 2 of 2


ECE 320 Linear Control Systems Fall 2010 - 11

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.

2. 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.

3. 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.

4. For the control system with the following open loop transfer function,

ECE 320 HWK 9.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

i. Use MATLAB to create the root locus


ii. Use MATLAB to create the Nyquist diagram for K = 10, 100
iii.Use MATLAB to create the Bode diagram for K = 10, 100
iv. determine the gain crossover frequency, phase crossover frequency, gain margin and
phase margin for K = 10, 100 and state whether the system is stable at each gain
5. For the control system with the following open loop transfer function,

i. Use MATLAB to create the root locus


ii. Use MATLAB to create the Nyquist diagram for K = 100, 1000
iii.Use MATLAB to create the Bode diagram for K = 100, 1000
iv. determine the gain crossover frequency, phase crossover frequency, gain margin and
phase margin for K = 100, 1000 and state whether the system is stable at each gain
6. For the control system with the following open loop transfer function,

i. Use MATLAB to create the root locus


ii. Use MATLAB to create the Nyquist diagram for K = 10
iii.Use MATLAB to create the Bode diagram for K = 10
iv. determine the gain crossover frequency, phase crossover frequency, gain margin and
phase margin and state whether the system is stable
7. Estimate the gain margin, phase margin, gain crossover frequency and phase crossover
frequency for a control system with the following Bode diagram.
HWK10 - P7 - Bode Diagram of G(s)H(s)

0
Magnitude (dB)

-5

-10

-15

-20
0

-45
Phase (deg)

-90

-135

-180

-225
-1 0 1
10 Frequency10(rad/sec) 10

ECE 320 HWK 9.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 9.docx CAB Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

Homework 10
Lectures 9-2 through 10-2
Modern Control – State Space Design

1. Determine if the following systems are controllable and observable.

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.
̇ [ ] [ ] [ ]

ECE 320 HWK 10.docx CAB Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

ECE 320 HWK 10.docx CAB Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

9. Verify your answers to problem 1 by using the following MATLAB code:

Cm = ctrb(A,B); %create the controllability matrix


if rank(Cm)==length(A) %determine if Cm is full rank
disp('controllable')
else
disp('not controllable')
end

Om = obsv(A,C); %create the observability matrix


if rank(Om) == length(A) %determine if Om is full rank
disp ('observable ')
else
disp ('not observable ')
end

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].

ECE 320 HWK 10.docx CAB Page 3 of 3


ECE 320 Linear Control Systems
Fall 2010 - 11

Excerpts from Dr. R. Throne’s Notes


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 1-1
Introduction to Linear Control Systems

Objective: Be able to define automatic, classical and modern control theory


Describe the difference between open-loop and closed-loop control
Explain the purpose and draw each of the elements of an open-loop and closed-
loop block diagram

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.

CAB Lecture 1-1 Page 1 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Figure 1: Feedback Control System

Control systems can be divided into 2 classes:


1. regulator – a control system that must maintain a physical variable at some constant
value in the presence of disturbances (i.e. a biological system to maintain the
temperature of the human body at 98.6 F)
2. servomechanism – a control system that requires a physical variable to follow or track
some desired time function (i.e. a robot that must follow a wall at a distance of 6 inches
for at least 6 feet)

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

CAB Lecture 1-1 Page 2 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

Turntable Speed Control


Assume a CD player or computer disk drive requires a constant speed of rotation in spite of
motor wear and variation and other component changes. A control engineer must design a
control system for turntable speed that will ensure that the actual speed is within a specified
percentage of the desired speed. A DC motor is used for the actuator to provide a speed
proportion to the applied motor voltage. A DC amplifier will be used from the input voltage to
the motor to provide the required power. Figure 2 is an example of the open-loop system.

Figure 2: Open-loop control of turntable speed


In order to design the feedback control system it is necessary to have a sensor on the turntable
to detect speed. A tachometer provides an output voltage proportional to the speed of its
shaft. The feedback control system should be better than the open-loop system because it
responds to the error and works to reduce it.

Figure 3: Closed-loop control of turntable speed


In-Class Activity:
A precise optical signal source can control the output power level to within 1 percent. A laser is
controlled by an input current to yield the power output. A microprocessor controls the input
current to the laser. The microprocessor compares the desired power level with a measured
signal proportional to the laser power output obtained from a sensor. The following block
diagram represents the feedback control system. Identify the function of each block and the
desired input variable, output variable, and measured variable and the control device.

Figure 4: Partial block diagram of an optical source

CAB Lecture 1-1 Page 3 of 3


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 1-2
Models of Physical Systems

Objective: Derive the transfer function for an electric system


Identify the type of response given the characteristic equation of a 2nd order
system
Find the poles, zeros, damping factor, damping ratio, natural frequency of a 2nd
order system
Calculate the unit impulse and step response of a 2nd order system

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.

Table 1: Summary of variables for electrical and mechanical systems

System Inductance Capacitance Resistance


Electrical v = L di/dt i = C dv/dt i = v/R
Spring Mass Damper
Mechanical v = 1/k dF/dt F = m dv/dt F = bv
Translational F = kx F = ma

In-Class Activity 1:
For the following electrical circuit, find the transfer function relating the capacitor voltage to the
input voltage?

CAB Lecture 1-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

The block diagram for the circuit would be shown as:

Vi(s) VC(s)

The characteristic equation of a second-order system is the denominator of the transfer


function and represented as s2 + 2ζωn s + ωn2, where ζ is the damping ratio and ωn is the
natural frequency. The roots of the characteristic equation are the poles of the system. The
roots of the numerator of the transfer function are the zeros of the system. At the poles, the
system goes to infinity and at the zeros the system goes to zero. The poles and zeros of a
system can be plotted on the s-plane. The damping ratio can be used to determine the type of
response of the system and this is summarized in Table 2.

Table 2: Summary of System Response Types


overdamped critically damped underdamped undamped
ζ>1 ζ =1 0<ζ<1 ζ =0
longest settling time fastest settling time fastest rise time oscillates forever

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Ω

CAB Lecture 1-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 1-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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])

CAB Lecture 1-2 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 1-3
Models of Physical Systems

Objective: Derive the transfer function for a mechanical system


Describe the analogs between electrical and mechanical 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.

Table 1: Summary of variables for electrical and mechanical systems

System Inductance Capacitance Resistance


Electrical v = L di/dt i = C dv/dt i = v/R
Spring Mass Damper
Mechanical v = 1/k dF/dt F = m dv/dt F = bv
Translational F = kx F = ma F=b ̇

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).

CAB Lecture 1-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

The block diagram for the mechanical system is

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.

CAB Lecture 1-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Velocity = v(t) = dy/dt

CAB Lecture 1-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Velocity = v(t) = dy/dt

CAB Lecture 1-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Table 1: Block Diagram Configurations

Type Block Diagram Equivalent Representation


Series R(s) G1(s) G2(s) Y(s) R(s) G1(s)G2(s) Y(s)
Y = G1G2R
Parallel G1(s)
Y = (G1 + G2)R + R(s) G1(s) + G2(s) Y(s)
R(s) Y(s)
+
G2(s)

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

CAB Lecture 2-1 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 2-1 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 2-1 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

Step Response Bode Diagram

sys=tf([200e3],[3 300e3]);bode(sys);

t = [0:1e-6:80e-6];u = ones(size(t));lsim(sys,u,t);axis([0 80e-6 0 .7]);

CAB Lecture 2-1 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Figure 1: State-Space Representation of the Open Loop Plant Block Diagram

CAB Lecture 2-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 2-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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).

CAB Lecture 2-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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).

CAB Lecture 2-2 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 2-3
State Equation Solutions and Transfer functions

Objective: Derive the solution to the state equations


Convert between the state-space and transfer function representation

The solution to the state equation can be found by finding the Laplace transform of the
equation.

̇  sX(s) – x(0) = AX(s) + BU(s)  [sI-A]X(s) = x(0) + BU(S),

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 .

CAB Lecture 2-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11
In-Class Activity 2:
For the electrical circuit in the previous activity, assume that the input is a unit step function and the initial
conditions are zero. Solve for forced response of x(t) and the output, y(t) by using the resolvant of A or the state
At
transition matrix, e . Note that these two activities demonstrate that the linear property of superposition can be
used to find the complete solution for x(t) and y(t) for non-zero input and initial conditions. Finally, what is the
complete solution for x(t) and y(t)?

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) ̇  sX(s) – x(0) = AX(s) + BU(s)

2) y = Cx + Du  Y(s) = CX(s) + DU(s)


-1
1) [sI – A] X(s) = BU(S) X(s) = (sI – A) BU(s)

Substituting equation 2 into equation 1 yields


-1 -1
Y(s) = C(sI – A) BU(s) + DU(s) Y(s) = C(sI – A) BU(s) + DU(s)

So the transfer function is

( )
( ) ( )
( )

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.

CAB Lecture 2-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11
In-Class Activity 3:
Use the following state equations to determine the transfer function for 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.

̇ [ ] [ ]

[ ]

CAB Lecture 2-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11
It is also possible to derive the state-space representation from a system’s transfer function as shown in the
following activities.

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.
( )
( )
( )

CAB Lecture 2-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

First - order systems


A first-order system has one pole and has the following form:
( )
( )
( )
If U(s) = 1/s, then Y(s)
( )
The step response is
y(t) = K – Ke-t/ = yss(t) + ytran(t)
where K is the static gain or DC gain of the system when the frequency is zero. The time
constant, , is the time it takes the step response to rise to 63% of its final value. The pole of
the transfer function is the reciprocal of the time constant (i.e. the larger the time constant, the
slower the transient response).

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.

CAB Lecture 3-1 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Figure 1: Rise Time and Settling Time (First-order system)


In-Class Activity 1:
Determine the static gain, time constant, pole, rise time and settling time for the step response
of the following 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.

CAB Lecture 3-1 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Table 1: Second-order system step responses


Types Poles Damping y(t), t > 0
ratio
overdamped 2 real >1 1- K1e-t/ 1 - K2e-t/ 2
critically damped 2 real repeated =1 1- K1e-at - K2te-at
undamped 2 purely imaginary conjugates =0 1 – cos nt
underdamped 2 complex conjugates 0< <1 1- e-at(K1cos dt + K2sin dt)

Figure 2 presents a comparison of the 4 types of responses.

Figure 2: Second-order system step responses

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

( )

( ⁄ )
√ ( ⁄ )

CAB Lecture 3-1 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.
( )

CAB Lecture 3-1 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 3-2
Transient and Steady-State Response Analysis

Objective: Determine the characteristic mode and dominant poles of a system


Determine the location of poles on the s-plane for a second order system to
meet certain design specifications

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.

Figure 1: Second-order underdamped system pole plot


From the pole plot, trigonometry can be used to find R and 

√ √( ) ( √ )


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

CAB Lecture 3-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

The following figure illustrates the desired pole locations on the s-plane to meet certain design
specifications.

Tp < 2 s Ts < 3 s %OS < 10%, > 0.59


d > 1.57 s d > 1.33 s < 53.8 

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.

CAB Lecture 3-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Characteristic Mode and Dominant Poles


It is more difficult to define the rise time, setting time and percent overshoot for higher order
systems. However, some higher order systems can be modeled as 1 st or 2nd order systems if
there is a dominant pole(s) that are significantly far enough away from some of the poles on
the real part of the s-plane. A good rule of thumb is that the other poles should be at least 5
times away from the dominant poles.

For example, if the transfer function of a system is

( )
( )
( ) ( )( )( )( )

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.
( )
( ) ( )

CAB Lecture 3-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.
( )
( )( )

CAB Lecture 3-2 Page 4 of 4


ECE 320 Linear Control Systems
Fall 2010 - 11

Excerpts from Dr. R. Throne’s Notes


ECE 320 Linear Control Systems Fall 2010 - 11

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)

b) h(t) = e-2t u(t)

c) h(t) = [2 + sin(t)] u(t)

d) h(t) = [1 + t + e-t] u(t)

e) h(t) = [1 – t3e-0.1t] u(t)

f) h(t) = [te-tcos(5t) + e-2tsin(3t)] u(t)

g) ( )

h) ( ) ( )( )

i) ( )

CAB Lecture 3-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

To create the Routh table for the following characteristic equation


(s) = ansn + an-1sn-1 + an-2sn-2 +  + a1s + ao,
list all of the descending powers of s down to s0 in the first column. The first row is the
coefficients of the odd-numbered terms and the second row is the coefficients of the even-
numbered terms.

sn an an-2 an-4 an-6


sn-1 an-1 an-3 an-5 an-7
sn-2 b1 b2 b3 b4
sn-3 c1 c2 c3 c4
d1 d2 d3 d4
s0

The next rows are found by using the following formulas based upon the negative of the
determinant of a 2 x 2 matrix,
| | | | | |

| | | | | |

| | | | | |

CAB Lecture 3-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 3-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 3-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

There are two special cases of the Routh-Hurwitz criterion,


 A zero in the first column but other nonzero element in the row
 A row of zeros

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.

In-Class Activity 1 ( Method):


Use the Routh-Hurwitz criterion to determine if a system with the following characteristic
equation is stable.
(s) = s5 + 2s4 + 2s3 + 4s2 + 11s + 10

s5
s4
s3
s2
s1
s0

CAB Lecture 4-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 2 (Reciprocal Method):


Use the Routh-Hurwitz criterion to determine if a system with the following characteristic
equation is stable.
(s) = s4 + s3 + s2 + s + 1

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.

CAB Lecture 4-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 4-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 4-2 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 4-3
Steady-State Error

Objective: Derive the position, velocity and acceleration error constants


Determine the steady-state error of a unity feedback control system using the
feed forward gain or closed loop transfer function
Identify the steady-state error characteristics based upon system type

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

Figure 1: Closed loop Control System


Table 1: Control System Components
Controller Plant Sensor
Integrator Temperature difference and heat flow Position – potentiometer
Differentiation Velocity and Force Velocity – tachometer
Delay Rotary velocity and torque Velocity – encoder
Electronics Pressure and fluid flow Acceleration - accelerometer
Filters (LPF,BPF) Voltage and Current Temperature – thermistor
Compensators
Lag, Lead, PI, PID

CAB Lecture 4-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

The transfer function, T(s) of a feedback closed loop system is


( ) ( )
( )
( ) ( ) ( )

The error off the closed-loop system is given by e(t) = r(t) – y(t).

The steady-state error for a step input, r(t) = Au(t) is given by

[ ( )] [ ( ) ( )] ( )

( ) ( )
[ ( )] [ ( )] ( ) [ ( )]

[ ]

The steady-state error for a ramp input, r(t) = Atu(t) is given by

[ ( )] [ ( ) ( )] [ ( ) ( ) ( )]
( )
[ ( )] [( ) ( ( ))] *( ) ( )+

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.

[ ]

The steady-state error for a parabolic input, r(t) = At2u(t) is given by

[ ( )] [ ( ) ( )] [ ( ) ( ) ( )]

[ ( )] [( )( ( ))]
( ) ( )
*( )( )+

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.

[ ]

CAB Lecture 4-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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) ( )

CAB Lecture 4-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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?

CAB Lecture 4-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 5-1
Steady-State Error

Objective: Derive the position, velocity and acceleration error constants


Determine the steady-state error of a unity feedback control system using the
feed forward gain or closed loop transfer function
Identify the steady-state error characteristics based upon system type

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

Input ess Notes


step, r(t) = Au(t)
[ ]
ramp, r(t) = Atu(t) no=do, zero ess for step input
[ ]
parabolic, r(t) = At2u(t) n1 = d1, zero ess for ramp input
[ ]

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,

CAB Lecture 5-1 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

[ ] , where Kp is the position error constant

Ramp Input

[ ] [ ] , where Kv is the velocity error constant

Parabolic Input

[ ] [ ] , where Ka is the acceleration error constant

Table 2 provides a summary of the relationships between the three typical inputs, steady-state
error and error constants.

Table 2: Steady-state error using the feed forward transfer function

Type step ramp parabolic Notes


0   ( )

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.

CAB Lecture 5-1 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 5-1 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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).

power amplifier servomotor


error 10(s+2)
Input +_ 12 Output
R(s) (s+3)(s+4)
Y(s)

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)

CAB Lecture 5-1 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 5-2
Sensitivity Analysis

Objective: Define the sensitivity of a feedback control system


Derive the sensitivity function based upon parameter or block variations
Determine the steady-state error and sensitivity of a control system with a
disturbance or sensor noise

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:

  
( ) | |
      

CAB Lecture 5-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Sensitivity Function Bode Diagram


5

0
Magnitude (dB)

-5

-10

-15

-20
90
Phase (deg)

45

0
-1 0 1
10 10 10
Frequency (rad/sec)

CAB Lecture 5-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 5-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 5-2 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 5-3
Sensitivity Analysis

Objective: Define the sensitivity of a feedback control system


Derive the sensitivity function based upon parameter or block variations
Determine the steady-state error and sensitivity of a control system with a
disturbance or sensor noise

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)

( )
( )
( ) ( ) ( )

To reduce sensitivity, make |1 + Gc(j)Gp(j)| as large as possible.

( ) ( ) ( )
( )
( ) ( ) ( ) ⁄( ( ) ( ))

To reduce sensitivity, make |Gc(j)Gp(j)| as small as possible.

CAB Lecture 5-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 5-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 5-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 5-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 6-1
Root Locus Analysis

Objective: Describe the root locus of a control system


Explain the purpose of root locus analysis and design
Review the five rules for creating a root locus plot
Use the rules to sketch the root locus for a control system
Determine the range of K values for a control system to be stable and identify
them on a root locus

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.

For the following control system,

Recall that, the closed-loop and open-loop transfer functions are


( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( ) ( )

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).

CAB Lecture 6-1 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Table 1: Rules to sketch the root locus

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.
( )
( ) ( )
( )

( ) ( ) ( ) ( )

CAB Lecture 6-1 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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
( )

Rule 4: Calculate the Centroid of the asymptotes 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.

CAB Lecture 6-1 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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
( )

Rule 4: Calculate the Centroid of the asymptotes 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.

CAB Lecture 6-1 Page 4 of 4


     
ECE 320 Linear Control Systems    Fall 2010 ‐ 11   
 
Lecture 6‐2 
Root Locus Analysis and Design 
 
Objective:  Sketch the root locus for a control system 
  Determine the range of K values for a control system to be stable and identify 
them on a root locus 
  Use design specifications and a root locus plot to determine desired pole 
locations and parameter gain for a control system. 
 
In‐Class Activity 1: 
For the following control system sketch the root locus plot.  Select the minimum value of K and 
related poles to design for a maximum peak time of 2 seconds. 

 
 

                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
 

CAB  Lecture 6‐2  Page 1 of 4 


     
ECE 320 Linear Control Systems    Fall 2010 ‐ 11   
 
In‐Class Activity 2: 

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. 

 
 

                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
   

CAB  Lecture 6‐2  Page 2 of 4 


     
ECE 320 Linear Control Systems    Fall 2010 ‐ 11   
 
In‐Class Activity 3: 
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 3 seconds and peak time less than 6 seconds. 

 
 

                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
                     

CAB  Lecture 6‐2  Page 3 of 4 


     
ECE 320 Linear Control Systems    Fall 2010 ‐ 11   
 
In‐Class Activity 4: 
For the following control system sketch the root locus plot.  Select the maximum value of K and 
related poles to design for a maximum percent overshoot less than 4.32%. 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
                     
 

CAB  Lecture 6‐2  Page 4 of 4 


ECE 320 Linear Control Systems
Fall 2010 - 11

Excerpts from Dr. R. Throne’s Notes


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 7-1 Page 1 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

 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)

Table 1 provides a graphical representation of these two key points.

Lag Lead Lag-Lead

( ) ( ) ( ) ( )
( ) = ( ) = ( ) =
( ) ( ) ( )( )

( )( )
( )
( ) ( )

Figure 1 Compensator Network Configurations

Table 1: Comparison and contrast of adding a pole or zero compensator


Proportional Control Lag compensator Lead Compensator
( )
( ) ( ) ( ) ( ) ( ) ( )
( ) ( ) ( )
K=1 K=1 K=1
type 0 type 1 type 0
ess = 1/2 ess = 0 ess = 1/3
s1, s2 = -1 ± j s1, s2 = -0.122 ± j0.745, -1.75 s1, s2 = -1.5 ± j0.87

CAB Lecture 7-1 Page 2 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 7-1 Page 3 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 1 (Lead compensator):

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.

CAB Lecture 7-1 Page 4 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 2 (Lag compensator):


For a control system with open loop gain KGp(s)H(s) = , design a lag compensator by
( )
selecting values for K, zlag and plag such that  = 0.707 and to improve the steady-state error due
to a unit ramp input by a factor of 10.

CAB Lecture 7-1 Page 5 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 3 (Lag-Lead compensator):


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.

CAB Lecture 7-1 Page 6 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 3 (Lag-Lead compensator) cont.:

CAB Lecture 7-1 Page 7 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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

A special case of the lag-lead compensator is a PID (proportional-integral-derivative)


controller. PID control is frequently used in industrial process control because it has good
performance in a wide range of operating conditions and it has functional simplicity. PID
control introduces a pole at the origin and two zeros in the left half s-plane of a control system.
The PID controller has the form, .

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.

Figure 1: P, PD, PID Control of a Wall Following Robot

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, .

CAB Lecture 7-2 Page 1 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Figure 2: Compensator Network Configurations

Table 1 provides a summary of the six types of compensators and their characteristics.

Table 1: Controller and Characteristics


Controller Design Characteristics
lag improves the steady state error but it is not zero
the pole is small and negative and the zero is close to the pole
lead improves the transient response
select the pole and zero to put a design point on the root locus

CAB Lecture 7-2 Page 2 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Table 2: Comparison of PI, PD and PID Controllers for Gp(s) = 1/(s+1)2

PI PD PID

K=1 K=1 K=1


type 1 type 0 type 1
ess = 0 ess = 1/3 ess = 0
poles = -1.544, -0.228 ± j1.115 poles = -1.5 ± j0.87 poles = -2, -0. 5 ± j0.87
Root Locus Editor for Open Loop 1 (OL1) Root Locus Editor for Open Loop 1 (OL1)
8 1.5

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

Step Response Step Response


1.5 1.4

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)

CAB Lecture 7-2 Page 3 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 7-2 Page 4 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 7-2 Page 5 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 7-2 Page 6 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Table 1: System Type Number Table

Type 1 a0 = b 0
Type 2 a0 = b0, a1 = b1
Type 3 a0 = b0, a1 = b1, a2 = b2

CAB Lecture 7-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 1:
For a control system with plant Gp(s) = ( , design a controller to place the poles at -3 and
)( )

-4 with a zero steady-state error due to a step input.

In-Class Activity 2:
For a control system with plant Gp(s) = ( )
, design a controller to place the poles at -1  j

and -1 with a zero steady-state error due to a step input.

CAB Lecture 7-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 7-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 7-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lecture 8-1 Page 1 of 5


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 8-1 Page 2 of 5


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 8-1 Page 3 of 5


ECE 320 Linear Control Systems Fall 2010 - 11

of counterclockwise encirclements of the -1 point on the Nyquist diagram. If N intersects the -1


point on the Nyquist diagram then the closed loop system has poles on the j axis.

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

sys=tf([0 0 0 5],[1 3 3 1]); nyquist(sys);

CAB Lecture 8-1 Page 4 of 5


ECE 320 Linear Control Systems Fall 2010 - 11

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.

pole at the origin poles on the


imaginary axis
In-Class Activity 4:
For the control system with an open loop transfer function,

G(s)H(s) = )
( )(

i. 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.
num = [4];
2
Nyquist plot of G(s)H(s) = 4/[s(s+1)(s+2)] den = conv([1 1 0],[1 2]);
sys = tf(num,den);
1.5 nyquist(sys);
1
v = [-3 .5 -2 2];axis(v);
title('Nyquist plot of G(s)H(s) = 4/[s(s+1)(s+2)]');
0.5 xlabel('Real Axis');
Imaginary Axis

ylabel('Imaginary Axis');
0

-0.5

-1

-1.5

-2
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5
Real Axis

CAB Lecture 8-1 Page 5 of 5


ECE 320 Linear Control Systems Fall 2010 - 11

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.

When a system is stable for all positive K, pc  , A(pc) = 0, GM  


When a system is unstable for all positive K, pc = 0 rad/s, A(pc)  , GM = 0 dB

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.

When a system is stable for all positive K, gc  ,  (gc)  , PM  


When a system is unstable for all positive K, gc = 0 rad/s,  (gc) = 180, PM = 0

The phase and gain margin can be determined from the Nyquist diagram or Bode diagram.

CAB Lecture 8-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

Bode Diagram of G(s)H(s) = 10K/[(s+2)(s+4)(s+6)]


20

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)

[GM, PM, wgc, wpc] = margin(sys1); gm = 20*log10(GM);margin(sys1);


[mag,phase,w] = bode(sys2); [GM, PM, wgc, wpc] = margin(sys2);
GM = 13.6 dB at 6.63 rad/s
PM = 72.7 at 2.54 rad/s

CAB Lecture 8-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

Bode Diagram of G(s)H(s) = 10K(s+1)/[s(s+5)(0.1s+1)]


100

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)

gc = 26 rad/s, PM = 30 , pc = , GM = 

CAB Lecture 8-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

Bode Diagram of G(s)H(s) = 10K(s+1)/[(s 2 + 3s + 3)(s+3) 2]


0

-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)

gc = , PM = , GM = 23.6 dB, pc =4.7 rad/s

CAB Lecture 8-2 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 8-3 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Figure 1: Lead Compensator


( ) ( ) ( ) ( ) 
⁄( )

Steps to design a lead compensator:


1. Determine the gain, K to satisfy the steady-state error requirement, ess (or let K = 1)
2. Plot the Bode diagram of the open loop transfer function with the gain K found in step 1
3. Determine the uncompensated phase margin, pm, from the Bode diagram
3b. If the required phase margin, PM, is not given, calculate the damping ratio, , from the


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/

CAB Lecture 8-3 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 1 (Lead Compensator):


Design the lead 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.
( ) ans: K = 10, Gc(s) = 4 (s + 4.41)/(s + 17.76)
( )

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

CAB Lecture 8-3 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 2 (Lead Compensator):

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

CAB Lecture 8-3 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Figure 1: Lag-Lead Compensator

⁄ ⁄
( ) ( ) ( ) ( )( ) ( )( )
⁄( ) ⁄( )
0< < 1, >1
Relevant Formulas:

CAB Lecture 9-1 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

√( ) √

√ √
( )

Steps to design a lag-lead compensator:


1. Determine the gain, K to satisfy the steady-state error requirement
2. Plot the Bode diagram of the open loop transfer function with the gain K found in step 1

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 /

CAB Lecture 9-1 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 9-1 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lecture 9-1 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

Figure 1 shows the state-feedback control system block diagram.


r + u B
+ x 1 x
C y
+ + s

-K

Figure 1: State-feedback control system


Phase-variable or controller canonical form is the easiest for designing controller gains.

⃛ ̈ ̇ ⃛ ̈ ̇

̇ [ ] [ ]

[ ]

CAB Lecture 9-2 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Steps to design the state-feedback controller:

1. Identify the state variable matrices: A, B, C, D


2. Calculate the matrix, sI – (A – BK)
3. Find the determinant of the compensated system, (s) = det[sI – (A – BK)]
4. Determine the desired characteristic equation to satisfy design constraints,
d(s) = sn + dn-1sn-1 + … + d1s + do
5. Equate coefficients to find controller gains, 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

CAB Lecture 9-2 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 2:
Design the following control system by selecting controller gains for 20.8% overshoot and a 4s
settling time.

̇ [ ] [ ] [ ]

CAB Lecture 9-2 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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) ̇ [ ] [ ]

CAB Lecture 9-2 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 10-1
State Space Observer Design

Objectives: Design an observer for system state estimation


Determine the observability of a control system

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

̇ [ ][ ]
[ ̇] [ ][ ] [ ] ̂
̂ ̂

observer error 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

Figure 1: Control system with observer

CAB Lecture 10-1 Page 1 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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

AC = AOT BC = COT CC = BOT

Steps to design the observer:


1. Identify the state variable matrices: A, B, C, D
2. Calculate the matrix, sI – (A – LC)
3. Find the determinant of the compensated system, (s) = det[sI – (A – LC)]
4. Determine the desired characteristic equation to satisfy design constraints,
d(s) = sn + dn-1sn-1 + … + d1s + do
5. Equate coefficients to find observer gains, L

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.

( )
( )( )( )

CAB Lecture 10-1 Page 2 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

In-Class Activity 2:
Design the observer for the following control system to have a 0.8s settling time and 16.3%
overshoot.

̇ [ ] [ ]
[ ]

CAB Lecture 10-1 Page 3 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

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) ̇ [ ] [ ] [ ]

CAB Lecture 10-1 Page 4 of 4


ECE 320 Linear Control Systems Fall 2010 - 11

Lecture 10-2
Integral control, Integrated Full-State Estimation and Feedback

Objective: Design an integral controller to improve steady-state error


Design a compensator for integrated full-state feedback and estimation

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

Figure 1: Control system with integrator

̇
Integral Control ̇ = -Cx + r [ ]
̇
[ ][ ] [ ]

̇
[ ] [ ][ ] [ ]
Integral state-feedback ̇
control
[ ]

Steps to implement integral state-feedback control:


1. Form the state equations with the integrated integral control
2. Find the characteristic equation for the system in step 1
3. Form the desired characteristic equation based upon the design specifications
4. Find the controller and integral gains by matching coefficients

CAB Lecture 10-2 Page 1 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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)

CAB Lecture 10-2 Page 2 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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.

̇ [ ] [ ] [ ]

system step response


1.4
original
state-feedback
1.2
integral control

0.8

0.6

0.4

0.2

0
0 1 2 3 4 5 6 7 8 9 10
time (s)

CAB Lecture 10-2 Page 3 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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

̇ [ ][ ]
[ ̇] [ ][ ] ̂
̂ ̂

observer error state equations output equation

̇ [ ][ ]
[ ̇] [ ][ ] ̃
̃ ̃

There are 3 steps for estimated state variable design:


1. Design the full-state feedback control law to place the closed-loop poles
2. Design the observer to estimate states
3. Connect the observer to the full-state feedback law, u = -K ̂

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

Figure 2: Integrated full state-feedback and estimation

CAB Lecture 10-2 Page 4 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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

error state variable, e2

error state variable, e3


0.2
0
0.5 0.1
-0.5
0

0 -0.1 -1
0 5 0 5 0 5
t (sec) t (sec) t (sec)

CAB Lecture 10-2 Page 5 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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

error state variable, e2

error state variable, e3


0 0.2
0
-1 0.1
-5
-2 0

-10 -3 -0.1
0 5 0 5 0 5
t (sec) t (sec) t (sec)

CAB Lecture 10-2 Page 6 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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.

Figure 3: Type 1 full order observer state variable feedback

Use the block diagram to complete the following table:

u=

̂̇

̃̇ ̇ ̂̇

̇
[ ̇] [ ][ ] [ ]
̂̇ ̂

̇
[ ̇] [ ][ ] [ ]
̃̇ ̃

CAB Lecture 10-2 Page 7 of 7


ECE 320 Linear Control Systems
Fall 2010 - 11

Excerpts from Dr. R. Throne’s Notes


ECE 320 Linear Control Systems Winter 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors.

Prelab: Read this laboratory theory and procedure thoroughly. Submit your answer to
the following question on engineering paper at the beginning of the lab.

a. The waveform in Figure 1 is the unit step response for a mass-cart-spring


system, estimate the peak time, damping frequency, percent overshoot,
damping ratio and static gain. Write the equation, G(s) that models this
system.

Mass-Cart-Spring Step Response


3.5

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)

Figure 1: Mass-cart-spring underdamped step response

b. The waveform in Figure 2 is the underdamped natural response for a mass-


cart-spring system, estimate the natural frequency and damping ratio using
the log-decrement method.

CAB Lab1.docx Page 1 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

mass-cart-spring natural response


2.5

1.5

y, cm

0.5

-0.5

-1

-1.5
0 0.5 1 1.5 2 2.5 3
Time (sec)

Figure 2: Mass-Cart-Spring Natural Response


Go to the Angel course folder, download and read “shortguide.pdf” to become
familiar with how to set up the Education Controls Product (ECP) Model 210. If
there are any questions, please ask your instructor.

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.

Figure 3: One DOF rectilinear mass-spring-damper system

The equation that models this system is given by

( )

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

CAB Lab1.docx Page 2 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

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.

Figure 4: Second-order system under-damped step response

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:

CAB Lab1.docx Page 3 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

√ ( )

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

Figure 7: Mass-cart-spring system setup diagram

CAB Lab1.docx Page 4 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

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.

D. Alternate estimation of static gain, K


1. There is an alternate method for estimating the static gain, by reading the data directly
from the x1 and time variables.
2. Set up the mass-cart-spring system with two masses as you did in part B. Collect data
on the step response for an amplitude, A = 0.04, 0.06 and 0.08. Make sure to set the
simulation stop time so that the system reaches steady state. See step C2 for an
alternate method for setting these values to avoid re-compiling after every change.
3. View x1 after each simulation and use the data to calculate the static gain.
4. Average the three estimates to produce a final estimate of the static gain, K. A
reasonable value should be between 5 and 30. If your value is not in this range make

CAB Lab1.docx Page 5 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

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

E. Log Decrement Estimate of and n


1. There is an alternate method for estimating the damping ratio and natural frequency
by using the log decrement method.
2. Set up the mass-cart-spring system with two masses as you did in part B.
3. Modify the Model210_Opennloop.mdl so that the step input has an amplitude of “0”.
4. Compile and connect to the ECP system. (The mode should be external)
5. Displace the cart and hold it.
6. Click “play” on Model210_Opennloop.mdl and let the cart go.
7. The XY graph of the natural response should be generated on the screen
8. Run the m-file log_dec.m that and the GUI in Figure 8 should open.

Figure 8: Log Decrement GUI Tool


9. Select Cart 1
10. Select Load IC (initial condition) Response (the variables x1 and time will be loaded
from workspace)
11. Set/modify the Final Time to be the same as the simulation stop time

CAB Lab1.docx Page 6 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

12. Select Plot IC Response to plot the initial condition response


13. Choose to identify the positive peaks (Locate + Peaks) or negative peaks (Locate -
Peaks). If the peaks are not numbered consecutively, you need to decrease the
Samples Between Peaks and try again until all peaks have been identified (see Figure
9).

Figure 9: Locate positive peaks on the Log Decrement GUI Tool

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).

Figure 10: Locate Decrement Figure with estimates

CAB Lab1.docx Page 7 of 8


ECE 320 Linear Control Systems Winter 2010 - 11

17. Repeat steps 1 to 16 for four masses on the cart.


18. You should include the different estimates of and n for the two systems in a table
and compare them to part C with part E as the nominal value.

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.

CAB Lab1.docx Page 8 of 8


ECE 320 Linear Control Systems Fall 2010 - 11

Lab 2
Frequency Domain Analysis of a 1DOF Rectilinear System

Objective: Collect experimental data from a 1DOF rectilinear system


Identify the parameters of the 1DOF system using frequency domain analysis

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

Prelab: Read the lab theory and procedure thoroughly.


Submit the answer to the following question on engineering paper the day
before lab.

The waveform in Figure 1 is the magnitude Bode diagram for a mass-cart-spring


system, estimate the static gain, Ko, maximum gain, K, natural frequency,n and
damping ratio, . Write the transfer function, G(s) that models this system.

mass-cart-spring Bode diagram


30

20

10
Magnitude (dB)

-10

-20

-30 1 2 3 4
10 10 10 10
Frequency (rad/sec)

Figure 1: Mass-cart-spring magnitude Bode diagram

If there are any questions, please ask your instructor.

CAB Lab2.docx Page 1 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Figure 2: Physical Meaning of Frequency Response of a Linear System

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/(2n) ). 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,

( )
( )

CAB Lab2.docx Page 2 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

Figure 3: Mass-cart-spring underdamped step response

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.

CAB Lab2.docx Page 3 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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

C. Fit your model to the transfer function


1. Run the program model_1dof.m at the MATLAB prompt. There are four input
arguments to this program:
 data, the measured data as determined by process_data_1dof.m
 K, the estimated static gain, found in Lab 1
 n, the estimated natural frequency from the log decrement analysis, found in Lab 1
 , the estimated damping ratio from the log decrement analysis
(i.e. model_1dof(data, K, wn, zeta));
2. The program model_1dof.m will produce the following:
 A graph indicating the fit of the identified transfer function to the measured data
 The optimal estimates of K, , and n written at the top of the graph

CAB Lab2.docx Page 4 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

 A file state_model_1dof.mat in your directory. This file contains the A, B, C, and D


matrices for the state variable model of the system. See Figure 5 for an example of
the experimental Bode magnitude plot with theoretical transfer function.

Optimal Fit To Frequency Response: gain = 5.393, n = 156 (rad/sec),  = 0.0246

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

D. Improve the model


1. Add at least 5 additional data points close to the resonant peak of the transfer function.
This is necessary to obtain the best model possible. Note that the horizontal axis is in
rad/s so you need to determine the frequency in Hz near resonance to enter into the
simulation.
2. Identify the 5 frequencies and repeat parts B and C of the procedure to improve the
model. Remember you are near resonance so you need to make the amplitude small
around 0.01 and be ready to stop the simulation if necessary.
3. Save the process_data_1dof.m file as Lab2_<your initials>_<#ofmasses>_data.m.
4. Save the state_model_1dof.mat file as Lab2_<your initials>_<#ofmasses>_model.mat.
5. These files contain the data and state variable model for the mass-cart-spring system
and will be used in all future labs. If you subsequently type load state_model_1dof, you
will load these matrices into your workspace.
6. REPEAT PARTS A – D for the 4 masses on the cart system that you built in Lab 1. Make
sure to use the same masses in the same order as you did in Lab 1.
7. You must include the improved graphs of the identified transfer function to the
measurement data for both system set ups in your lab memo.
8. Your memo should also include the state equation matrices and transfer function for the
2 plants.

Submission:
The lab memo will be due at the beginning of the next lab session. At a minimum it should
include the following:

CAB Lab2.docx Page 5 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

 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 results of the time domain analysis to
the frequency domain analysis.
 The discussion should also compare and contrast the system parameters for the two
mass versus the four mass system

CAB Lab2.docx Page 6 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

Lab 3
Analysis of a 2DOF Rectilinear System

Objective: Collect experimental data from a 2DOF rectilinear system


Identify the parameters of the 2DOF system using frequency and time domain
analysis

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

Prelab: Read the lab theory and procedure thoroughly. Submit the answer to the
following question on engineering paper the day before lab.

Figure 1 is the model of a 2DOF mass-cart-spring damper system. Derive the


state-space representation and transfer function for the translational mechanical
system where x1(t) is the output. Assume that m1 = m2 = 1 kg, k1 = 1 N/m and b1
= b2 = 1 N-s/m.

Figure 1: 2DOF mass-cart-spring-damper system

If there are any questions, please ask your instructor.


Theory:
The fundamental theory for frequency and time domain analysis of a 2DOF rectilinear system is
the same as for a 1DOF system. The two degrees of freedom means that two of the carts are
able to move. Similar to the 1DOF system, each of the carts will have a resonant frequency
where the Bode magnitude plot reaches a local maximum. The frequency response analysis
involves finding the magnitude of the Bode diagram as the frequency is varied and then
matching it to a transfer function model similar to the prior lab. The time domain analysis,

CAB Lab3.docx Page 1 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

CAB Lab3.docx Page 2 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

B. Log-Decrement (time domain analysis)


1. Reset the system using ECPDSPresetmdl.mdl.
2. Modify Model210_Openloop.mdl so the input has zero amplitude.
3. Compile Model210_Openloop.mdl and connect to the ECP system. (The mode should
be External.)
4. Lock the second cart and displace the first cart and hold it.
5. Click start (play) Model210_Openloop.mdl and let the cart go. The XY graph of the
initial condition response should be opened on the screen. Set the simulation stop time
so that it runs until the system reaches steady state.
6. Run the m-file log_dec.m and select the cart that moved, if it is cart 1 the position
variable is x1, if it is cart 2 the position variable is x2, and the time is labeled time.
7. Select Cart 1
8. Select Load IC (initial condition) Response
9. Select Plot IC Response to plot the initial condition response
10. Choose to identify the positive peaks (Locate + Peaks). If the peaks are not numbered
consecutively, you need to decrease the Samples Between Peaks and try again until all
peaks have been identified.
11. 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).
12. Select Estimate Parameters to get the initial estimates of 1 and 1.
13. Select Make Log-Decrement Figure to get a plot and summary of the results.
14. You must include the estimates of the natural frequency and damping ratio and the
log_dec figure in the lab memo.
15. Repeat part B steps 1 – 14 with cart 1 locked and cart 2 free to move.

C. Estimating the gains, K1 and K2


1. Be sure both carts are free to move, the cart farthest from the motor is locked in place.
2. Reset the system using ECPDSPresetmdl.mdl.
3. Modify Model210_Openloop.mdl so the input is a step. Set the amplitude to something
small, like 0.01 or 0.02 cm.
4. Compile Model210_Openloop.mdl and connect to the ECP system. (The mode should
be External.)
5. Run Model210_Openloop.mdl, if the carts do not seem to move much, increase the
amplitude of the step. If the carts move too much, decrease the amplitude of the step.
If the first cart does not move by at least 1.5 cm then you should increase the input
amplitude.
6. To determine the steady-state value of the cart position, don’t use the graph but view
the x1 and x2 variables in the MATLAB workspace.
7. Estimate the static gains by using the following formulas

(5)

CAB Lab3.docx Page 3 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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.

D. Frequency Domain Analysis


Similar to Lab 2, you will construct the magnitude portion of the Bode plot for the 2DOF
rectilinear system and fit the measured frequency response to the frequency response of
the expected transfer function to determine the system parameters. For each frequency,
= 2πf, there is an input u(t) = Acos( t), where A is measured in centimeters. After
the transient period, the steady-state output will be x1(t) = B1cos( t + 1) for the
first cart and x2(t) = B2cos( t + 2) for the second cart, where both B1 and B2 are
also measured in cm. Since you will create the magnitude portion of the Bode plot, the
phase angles (1 and 2) will be ignored.

1. Reset the system using ECPDSPresetmdl.mdl.


2. Modify Model210_Openloop.mdl so the input is a sinusoid. You may have to set the
mode to Normal.
3. Set the frequency to 0.5 Hz and small amplitude for the sinusoid such as 0.01 cm.
Generally this amplitude should be as large as you can make it without the system
hitting a limit. This amplitude will probably vary with each frequency.
4. Compile Model210_Openloop.mdl, connect Model210_Openloop.mdl to the ECP
system. (The mode should be External.)
5. Run Model210_Openloop.mdl, if the carts do not seem to move much, increase the
amplitude of the input sinusoid. If the carts move too much, decrease the amplitude of
the input sinusoid.
6. Use Excel to create a data table to record the input frequency (f), the amplitude of the
input (A), and the amplitude of the outputs (B1 and B2) when the system is in steady
state. Use the program get_Amp2.m to get the amplitudes accurately. Be sure the plot
from get_Amp2 shows the system in steady state. As always, review the code and make
sure that you understand how it works before you use it!! Sometimes the code may
have to be modified to be applicable to your needs.
7. Enter the values of f, A , B1 and B2 into the program process_data_2dof.m under the
measured_data variable
8. Repeat steps 1 through 7 for the following frequencies: 1, 1.5, 2, 2.5, 3, 3.5, …. 6.5,7, 7.5
Hz

E. Create and Improve the Model


1. At the Matlab prompt, type data = process_data_2dof;
2. Run the program model_2dof.m, which has the following ten arguments:
 data, the measured data as determined by process_data_2dof.m
 the estimated value of K2, the gain of the second cart system
 a, the estimated frequency of the first resonance, when both carts are moving, in
radians/sec

CAB Lab3.docx Page 4 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

 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

CAB Lab3.docx Page 5 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

 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 of the multiple methods used to find the
gain, damping ratio and natural frequency

CAB Lab3.docx Page 6 of 6


ECE 320 Linear Control Systems Fall 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

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.

Figure 1. Closed-loop control system

The transfer function for the closed loop system is


( ) ( ) ( )
( )
( ) ( ) ( )
One method to select the controller is to make the closed loop system match a
transfer function hence, the name “model matching”. Assume that the desired
closed loop transfer function is Go(s). The plant and closed loop transfer function
can be written in terms of numerators and denominators as
N ( s) N p ( s)
Go ( s)  o G p (s) 
Do ( s) Dp ( s)

1. Show that if the controller is stable and proper it can be written as

CAB Lab4.docx Page 1 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

N o ( s) Dp ( s)
Gc ( s) 
N p ( s)  Do ( s)  N o ( s) 

2. If the plant is ( ) , design the controller, Gc(s), so that the closed


loop control system matches a second - order ITAE (Integral of Time and
Absolute Error) optimal system with the following closed loop transfer
function,
02
G0 ( s) 
s 2  1.40 s  02
Note in your final answer that there is a pole/zero cancellation between the
controller and the plant and there is a pole at zero in the controller.

3. If the plant is ( ) , design the controller, Gc(s), so that the closed


loop control system matches a third-order deadbeat system with the
following closed loop transfer function,
03
G0 ( s) 
s3  1.900 s 2  2.2002 s  03
Note in your final answer that there is a pole/zero cancellation between the
controller and the plant and there is a pole at zero in the controller.

If there are any questions, please ask your instructor.


Theory:
Model matching is the process of selecting a controller such that a closed loop control system
matches a given model to satisfy certain design characteristics. For this lab, the two closed loop
models are the ITAE and deadbeat systems. A deadbeat response is a system with a rapid
response, minimal overshoot, and zero steady-state error for a step input. A system is
considered an optimum control system when the system parameters are adjusted so that the
index reaches an extremum, commonly a minimum value. A performance index is a
quantitative measure of the performance of a system and a suitable one is the integral of the
square of the error, ISE defined as

∫ ( )

Another performance criterion is the integral of the absolute magnitude of the error, IAE
defined as

CAB Lab4.docx Page 2 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

∫ | ( )|

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.4os + o2 s + 1.182os + o2
2

3 s3 + 1.75os2 + 2.15o2 s + o3 s3 + 1.9os2 + 2.20o2 s + o3


4 s4 + 2.1os3 + 3.4o2s2 + 2.7o3s + o4 s4 + 2.2os3 + 3.5o2s2 + 2.8o3s + o4
Table 1: Optimum coefficients of T(s) based on the
Deadbeat and ITAE criterion for a step input
One goal of this lab is to use model matching to select a controller so that the overall system
meets certain design criteria. If the closed loop transfer function is known such as Deadbeat or
ITAE then the controller can be found from the prior equation. However, there are some
limitations on this type of model matching given by the following set of rules
1. The controller is a proper rational transfer function
2. The controller is stable
3. The degree of the closed loop denominator –the degree of the closed loop numerator ≥
the degree of the plant denominator – the degree of the plant numerator
4. All of the right half plane zeros of the plant must also be zeros in the closed-loop
transfer function
5. The closed loop transfer function is stable
We will assume that all of these conditions are satisfied for the lab procedure implementation.

CAB Lab4.docx Page 3 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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

B. Model Matching of a 1DOF system


1. You will design a closed loop control system to meet the following design requirements:
 Settling time less than 0.5 seconds.
 Absolute value of the steady state error less than 0.1 cm for a 1 cm step, and less
than 0.05 cm for a 0.5 cm step
 Percent Overshoot less than 10%
2. Set up the 1DOF rectilinear system with two masses just as you did in Lab 2, refer to your
memo or system diagram.
3. Modify closedloop_driver.m to read in the lab 2 model file for a 1DOF rectilinear system
with two masses (i.e. load Lab2_<your initials>_0_model)
4. Use the second order zero position error ITAE system and vary o until you meet the design
specifications with the simulation (closedloop_driver.m). This means to uncomment the
MATLAB code with this transfer function (Go) and comment out the rest. Note that the
larger the value of o, the faster your system will respond and the closer your model will
predict the response of the real system. At this point all of the variables you should need
are in your current MATLAB workspace. You should run the simulation until the system is
clearly at a steady state value for at least one second. Be sure you do not reach the limiter
on the control effort. When the control effort saturates, this is where the motor must
provide more torque than it can produce. This is to be avoided at all costs! Figure 2
presents an example of a simulation output from the closed loop driver.

CAB Lab4.docx Page 4 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Figure 2: Closed Loop Driver Simulation Results

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.

CAB Lab4.docx Page 5 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

Lab 2 0 masses model matching wo = 25 rad/s 2nd order deadbeat


1

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)

Figure 3: Comparison of closed loop simulation and actual results

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.

C. Model Matching of a 2DOF system


1. You will design a closed loop control system to meet the following design requirements:
 Settling time less than 1.0 seconds.
 Absolute value of the steady state error less than 0.1 cm for a 1 cm step, and less
than 0.05 cm for a 0.5 cm step
 Percent Overshoot less than 10%
2. Set up the 2DOF rectilinear system exactly as you did in Lab 3, refer to your memo or
system diagram.
3. Modify closedloop_driver.m to read in the lab 3 model file for a 2DOF rectilinear system
(i.e. load Lab3_<your initials>_2dofmodel)
4. Use the fourth order zero position error ITAE system and vary o until you meet the design
specifications with the simulation (closedloop_driver.m). Note that the larger the value of
o, the faster your system will respond and the closer your model will predict the response
of the real system. At this point all of the variables you should need are in your current
MATLAB workspace. You should run the simulation until the system is clearly at a steady
state value for at least one second. Be sure you do not reach the limiter on the control
effort. When the control effort saturates, this is where the motor must provide more
torque than it can produce. This is to be avoided at all costs!
5. Open and compile Model210_Closedloop.mdl.

CAB Lab4.docx Page 6 of 7


ECE 320 Linear Control Systems Fall 2010 - 11

6. Reset the system by running ECPDSPReset.mdl, connect Model210_Closedloop.mdl to the


system and then run it.
7. 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.
8. Repeat steps 4 through 7 for the fourth order deadbeat system.

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

CAB Lab4.docx Page 7 of 7


ECE 320 Linear Control Systems Winter 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

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)

Figure 1. Closed-loop control system

1. Use the Routh-Hurwitz criterion to determine the range of K for system


stability
2. Create a plot of the closed loop poles on the s-plane as the controller gain K is
varied from 0 to 18.
3. Use the rlocus(tf(num,den)) MATLAB command to create the root
locus plot for the open loop transfer function in Figure 1. Note that you must
use the open loop transfer function with K = 1 in the MATLAB command.

If there are any questions, please ask your instructor.

CAB Lab6.docx Page 1 of 4


ECE 320 Linear Control Systems Winter 2010 - 11

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.

CAB Lab6.docx Page 2 of 4


ECE 320 Linear Control Systems Winter 2010 - 11

a. stable b. unstable

Figure 1: System Sample Step Responses


D. System Analysis
1. Plot all of the step response on two sets of axes with no more than 5 step responses per
axes. Make sure the plot has a title, axes labeled and a legend to make it clear which gain
corresponds to each step response. See Figure 2 for an appropriate step response graph.
You should include these figures in your lab memo submission.

Figure 2: Step responses for K = 0.1 to 0.5

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).

CAB Lab6.docx Page 3 of 4


ECE 320 Linear Control Systems Winter 2010 - 11

damping ratio versus gain damped frequency versus gain


0.5 40
0.4 30
damped
damping 0.3
frequency, 20
ratio 0.2
rad/s
0.1 10
0 0
0 0.1 0.2 0.3 0.4 0.5 0 0.1 0.2 0.3 0.4 0.5
Controller gain, K Controller gain, K

Figure 3: Damping ratio and damped natural frequency versus gain

6. Recall that the closed-loop poles of the system are given by -d ± jd = -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

Figure 4: Experimental Root Locus


7. Save all of your 1DOF and 2DOF state models to a thumb drive or email them to yourself
because you need them to complete prelab 7.

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

CAB Lab6.docx Page 4 of 4


ECE 320 Linear Control Systems Winter 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

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

( )
( )

CAB Lab7.docx Page 1 of 6


ECE 320 Linear Control Systems Winter 2010 - 11

show that the coefficients are determined by kd  a , k p  ab , and ki  ac .


5. Use Matlab's sisotool to design two PID controllers (one with complex conjugate zeros, one
with real zeros) for your system. Initially limit your gains as you will in the lab to

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)

Figure 1: Bad Control Effort Example

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.

CAB Lab7.docx Page 2 of 6


ECE 320 Linear Control Systems Winter 2010 - 11

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.

If there are any questions, please ask your instructor.

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

Input Gpf +_ Gc(s) Gp(s) Output


R(s) Y(s)

H(s)

Figure 1: Closed loop control system with prefilter

CAB Lab7.docx Page 3 of 6


ECE 320 Linear Control Systems Winter 2010 - 11

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%

C. PID Control (complex conjugate zeros)


1. Design a PID controller with complex conjugate zeros using sisotool to meet the design
specifications. You should have already completed some of these designs in sisotool for
your prelab. Use a constant prefilter (i.e., the number 1).
2. Implement the correct gains into the closedloop_driver.m which simulates the
closedloop.mdl.
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 the 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.

CAB Lab7.docx Page 4 of 6


ECE 320 Linear Control Systems Winter 2010 - 11

D. PID Control (real zeros)


2. Design a PID controller with real zeros using sisotool to meet the design specifications. You
should have already completed some of these designs in sisotool for your prelab. Use a
constant prefilter (i.e., the number 1).
3. Implement the correct gains into the closedloop_driver.m.
4. 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)
5. Reset the system by running ECPDSPReset.mdl
6. Compile and run Model210_Closedloop.mdl and connect to the system to run the actual
hardware response
7. 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.
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 7 for the one degree of freedom system with four masses.

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

CAB Lab7.docx Page 5 of 6


ECE 320 Linear Control Systems Winter 2010 - 11

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

CAB Lab7.docx Page 6 of 6


ECE 320 Linear Control Systems Winter 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

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%

As a start, you should initially limit your gains as follows:

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).

CAB Lab8.docx Page 1 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

Figure 1: Control and Estimation Tools Manager

2. Select the correct architecture and make sure that sisotool uses negative feedback for both
loops (see Figure 2).

Figure 2: Control Architecture


3. Click OK, and then click Loop Configuration on the Control and Estimation Tools Manager
4. On the drop down menu select Open Loop-Output of C1 and check Open for Output of
Block C2.
5. On the drop down menu select Open Loop-Output of C2 and check Open for Output of
Block C1 (see Figure 3)

CAB Lab8.docx Page 2 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

Figure 3: Loop Configuration


6. Go back to the Control and Estimation Tools Manager and select the Graphical Tuning tab.
7. Choose to plot the Root Locus plot for both Open Loop 1 and Open Loop 2 as shown in
Figure 4.

Figure 4: Design Plot Configurations

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.

CAB Lab8.docx Page 3 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

Figure 5: SISO Design for SISO Design Task

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.

Figure 6: Root locus for PI-D controller

12. The step response for this controller configuration is shown in Figure 7.

CAB Lab8.docx Page 4 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

Figure 7: Step response for PI-D controller

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.

Figure 8: Root Locus for I-PD controller

CAB Lab8.docx Page 5 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

16. The step response for the I-PD controller is shown in Figure 9.

Figure 9: Step Response for I-PD controller


17. Now use sisotool to design an I-PD and I-PD controller for the 3 one degree of freedom
systems you built in Lab 1 to meet the design specifications. If you cannot meet the design
specifications exactly, do the best you can. All of your designs will use a constant prefilter,
although you will also implement the dynamic prefilter in lab.
18. You should submit four graphs for each of the systems (PI-D root locus, PI-D step response,
I-PD root locus, I-PD step response). Make sure that you provide a descriptive title that
includes kp, ki and kd and label the axes.

If there are any questions, please ask your instructor.

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.

CAB Lab8.docx Page 6 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

Figure 10: PI-D and I-PD Simulink model

For the PI-D controller, the controller transfer functions are:

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') ;

CAB Lab8.docx Page 7 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

Go = C1*Gp/(1 + C2*Gp + C1*Gp);


Go = minreal(Go);

4. Rename the ECP simulation file, closedloop.mdl as closedloop_PID_<your initials>.mdl.


Modify the new simulation model by creating the block diagram shown in Figure 10.
Change the sim function in the closedloop_driver.m to call the new simulation file,
closedloop_PID_<your initials>.mdl.
5. Rename the ECP driver file, Model_210_Closedloop.mdl as Model210_PID_<your
initials>.mdl. Modify the new hardware model by creating the block diagram shown in
Figure 10.

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.

CAB Lab8.docx Page 8 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

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

CAB Lab8.docx Page 9 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

 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

CAB Lab8.docx Page 10 of 10


ECE 320 Linear Control Systems Winter 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

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.

1DOF State Variable Feedback

The one degree of freedom Simulink model (Basic_1dof_State_Variable_Model.mdl)


implements a state variable feedback control model for a one degree of freedom system. This
model uses the Matlab code Basic_1dof_State_Variable_Model_Driver.m to control it. These
files are available in the Angel course folder under Lab 9 (Lab9.zip).

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;).

CAB Lab9.docx Page 1 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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.

2DOF State Variable Feedback

The two degree of freedom Simulink model (Basic_2dof_State_Variable_Model.mdl)


implements a state variable model for a two degree of freedom system. This model uses the
Matlab code Basic_2dof_State_Variable_Model_Driver.m to drive it.

a) Modify Basic_2dof_State_Variable_Model_Driver.m to load the correct state model into


the system.
b) Set the saturation_level to the correct level for the model 210 rectilinear system and
assume a step input of 1 cm, similar to what you did for the 1DOF system.
c) Design a state variable feedback system using pole placement for the two degree of
freedom rectilinear system. 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%
d) You will need to place 4 poles but the dominant poles affect the settling time and damping
ratio. The second two poles should be at least 5 times away from the dominant poles. You

CAB Lab9.docx Page 2 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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.

Pendulum State Variable Feedback

The simulink model, Basic_2dof_State_Variable_Model_pend.mdl, implements a state variable


model for a pendulum. This model uses the MATLAB code,
Basic_2dof_State_Variable_Model_Driver_pend.m to control the system. You will modify
Basic_2dof_State_Variable_Model_Driver_pend.m to work with the regular pendulum model.
Specifically, you need to

 Load the regular model for the pendulum (load regular_model;)


 Since we are trying to hold the pendulum in place, this is a regulator problem so set the
input to zero (Amp=0;) .
 Next, set the initial angle of the pendulum to 0.05 radians and all other initial conditions
to zero (ic_x1 = 0;ic_x1_dot=0;ic_theta=0.05;ic_theta_dot=0;).
 Use the pole placement method to control the position of the pendulum and the cart.
The goal is to keep the pendulum pointing straight down 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 second.
 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.

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

 Load the inverted model for the pendulum (load inverted_model;)


 Since this is still a regulator problem, the input should be zero

CAB Lab9.docx Page 3 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

 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.

Pendulum – 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.

Figure 1: Pendulum on a cart system

The equations of motion for the regular pendulum can be written as

CAB Lab9.docx Page 4 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

( J  ml 2 )  ml cos( ) x  mgl sin( )  0


 M  m  x  ml cos( )  ml sin( )  cx  kx  F
2

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 ̈ ̈ 

If we assume the cart is fixed, then ̈ and we have ̈ 

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 .

The second equation of motion can be rewritten as ̈ ̈ ̇

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

CAB Lab9.docx Page 5 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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.

The linearized dynamical equations are

1
   
2
x 2
 
g
x  2 1 1 x 2
1 x  K1 12  K 2 2
1 F

By substituting the second equation into the first equation, we get

1 2
 2
12 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

Defining q1 = x, ̇,  and ̇ , we get the following state equations

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

CAB Lab9.docx Page 6 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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.

B. 1DOF Pole Placement Design


1. Set up the 1DOF system with two masses exactly as you did when you determined its model
parameters.
2. Modify Basic_1dof_State_Variable_Model_Driver.m to read in the correct model file and
to use the correct saturation_level for the Model 210 system. The input is a 1 cm step.
3. Design a state variable controller using pole placement to control the position of the cart to
meet the design specifications. You should 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.

CAB Lab9.docx Page 7 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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.

poles = -40 and -22, k 1 = -0.026139, k 2 = 0.007176, GPF = 0.105


1
Displacement (cm)

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)

Figure 2: 1DOF Pole Placement Simulation Results

C. 2DOF Pole Placement Design


1. Set up the 2DOF system exactly as you did when you determined its model parameters
2. Modify Basic_2dof_State_Variable_Model_Driver.m to read in the correct model file and
to use the correct saturation_level for the Model 210 system. The input is a 1 cm step.

CAB Lab9.docx Page 8 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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];).

D. Regular Pendulum Pole Placement Design


a. Set up the system
1. The state equations for the regular pendulum were derived in the prelab. All of the
quantities must be identified to get the A and B matrices for the state variable description.
For this system, D = 0 and C is determined by what you want the output to be (i.e. cart (C =
[1 0 0 0];) or pendulum (C = [0 0 1 0];)).
2. Lock all of the carts except the one closest to the motor, place two large masses on the first
cart and one heavy (stiff) spring between the first and second cart. There is no spring
between the motor and the cart and the damper is not attached.
3. The pendulum should be securely fastened to the first cart and rest on top of the masses
and be securely tightened.
4. The mass on the pendulum should be within about 2 or three inches from the pivot.
Remember that the cart must be able to get under the center of mass of the pendulum in
order to right it, so if the center of mass of the pendulum is too far away the cart will never
be able to get under it. The ECP system should be moved to the edge of the bench, so that
the pendulum is completely free to swing without hitting the bench.
5. The wire to measure the position of the pendulum position encoder should be securely
attached (with the screws) and the cart and pendulum should be free to move (see Figure
2).

CAB Lab9.docx Page 9 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

Figure 2: Regular Pendulum Set Up


b. Estimate 
1. From the equations of motion, if we assume the cart is fixed, then ̈ = 0 and we have
̈  . This is the equation for the simple pendulum, if the pendulum is deflected
and released it will oscillate with a frequency of .
2. To measure this frequency, set the amplitude of the input in Model210_Openloop.mdl to
“0” and confirm that the base address is correct.
3. Displace the pendulum and let it go. Since we are using a small angle assumption, the
pendulum should not be displaced too far.
4. Using MATLAB, plot the displacement of the pendulum versus time. This is the variable
theta in the MATLAB workspace. Determine the period (T) of the pendulum oscillations
and use the period to calculate .
5. You should include a graph of the pendulum oscillation (plot(time, theta)) with a
descriptive title in your memo submission (see Figure 3).
regular pendulum, wo = 7 rad/s
0.5

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 .

CAB Lab9.docx Page 10 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

c. Estimate 1 and 1 using log-decrement analysis


1. If we assume that there is no input to the cart (F = 0) and the pendulum does not move very
much (̈  0) then we have

̈ ̇

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.

e. Fit the estimated frequency response to the measured frequency response


1. This method will be used to determine K1 and to get better estimates of 1 and 1. At this
point, all of the variables needed for the state variable model will be determined. The
magnitude portion of the Bode plot will be constructed and fitted to the measured
frequency response of the expected transfer function to determine these parameters.
2. For frequencies f = 1, 1.5, 2, 2.5, …. 5 Hz modify Model210_Openloop.mdl so the input is a
sinusoid with amplitude of “0.1”. As you approach resonance, you may have to decrease
the input amplitude to keep the cart from hitting the stops by moving more than 2.5 cm.
Make sure you also have at least 2 or 3 data points near the pendulum’s natural frequency,
f .
3. Compile Model210_Openloop.mdl, connect to the ECP and run the model. If the cart does
not move much, increase the amplitude of the input sinusoid. If the cart hits the stops, you
need to adjust the pendulum. Note that you can make the input amplitude a variable such
as amp in the SIMULINK block diagram and make the frequency a variable such as freq in
the SIMULINK block diagram and set the values in the MATLAB command window to keep

CAB Lab9.docx Page 11 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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;

f. Modeling the Regular Pendulum


1. Run the program model_pendulum_full.m; there are 5 input arguments to this program:
 data, the measured data as determined by process_data_pendulum.m
 K2, the estimated value from part d
 , the estimated frequency of the pendulum, in Hz from part b
 1, the estimated damping ratio of the cart from part c
 1, the estimated natural frequency of the cart, in Hz from part c

2. The program model_pendulum_full.m will produce the following:


 A graph of the fitted transfer function of the position of the cart to the input to the
measured frequency response data. The optimal estimates of all parameters is(written
at the top of the graph (see Figure 4).
 A file state_model.mat in your directory. This file contains the A, B, C, and D matrices
for the state variable model of the system. Rename this file to something similar to
regular_pend_model.mat.
 A list of the poles and zeros of the estimated transfer function are printed to the
MATLAB command window. This allows you to see how close to a pole/zero cancellation
you have (this is 6.6133 rad/s for Figure 4).
 You need to be sure you have 4 points close to the resonant peaks of the transfer
function. This is particularly true if you have very small values of (<0.1), which
correspond to very sharp peaks. In addition, you should add a couple of points near the
frequency of the pole/zero cancellation to clean things up and simulate the system at
the natural frequency of the pendulum. At a minimum you should add 6 additional
points.
 You should also compare the final estimates of the parameters with your initial
estimates (i.e. error analysis). The values for all of the frequencies and gains should be
fairly close to the final values however, the damping ratios may be quite different.

CAB Lab9.docx Page 12 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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)

Figure 4: Regular Pendulum Model with pole/zero cancelation at  = 6.6133 rad/s

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.

CAB Lab9.docx Page 13 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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

Pendulum Position (rad)


Cart Position (cm)

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)

Figure 5: Regular Pendulum State Variable Feedback Design Simulation Results

CAB Lab9.docx Page 14 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

h. Modeling the Inverted Pendulum


1. Run the program model_inverted_pendulum_full.m; there are 5 input arguments to this
program:
 data, the measured data as determined by process_data_pendulum.m
 the estimated value of K2
 , the estimated frequency of the pendulum, in radians/sec
 1, the estimated damping ratio of the cart.
 1, the estimated natural frequency of the cart, in radians/sec

2. The program model_inverted_pendulum_full.m will produce the same output as the


program model_pendulum_full.m produced. The only difference will be the state variable
model. You should rename this model to sometime like inverted_pend_model.mat. You
should include the state variables (A, B, C, D) and transfer function in your lab memo
submission.

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

CAB Lab9.docx Page 15 of 16


ECE 320 Linear Control Systems Winter 2010 - 11

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.

Figure 6: Inverted Pendulum State Variable Feedback Control

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

CAB Lab9.docx Page 16 of 16


ECE 320 Linear Control Systems Fall 2010 - 11

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

Caution: The ECP systems are expensive and can be damaged!


Have one member of your group ready to push the hardware shut off button
when you are running an experiment if necessary.
Do not touch the system while it is running.
Turn off the ECP power before changing connectors

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.

CAB Lab10.docx Page 1 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

Integral Control 1DOF Model

1) Create a Lab 10 folder on your hard drive.


2) Copy the program, Basic_1dof_State_Variable_Model_driver.m, from a prior lab to the Lab
10 folder and rename it, sv1_integral_driver.m.
3) Copy the Simulink file Basic_1dof_State_Variable_Model.mdl to the Lab 10 folder and
rename it, sv1_integral.mdl.
4) Modify sv1_integral_driver.m to implement state variable feedback using integral control.
This includes changing the load command to add the A, B, C, and D matrices from the prelab
model file (state_model_1dof_rect.mat). This also includes defining the A and B matrix for
the integral controller in order to place the poles,
[ ] [ ]
5) You should also set all of the initial conditions on the integrators to zero
(ic_x=0;ic_x_dot=0;). Lastly change the simulation to the new model file
(sim(‘sv1_integral.mdl’);). You may also have to define the C matrix dependent
upon whether you want the output to be the cart position or velocity.
6) Modify sv1_integral.mdl to implement state variable feedback using integral control. The
basic integral control scheme is shown below in Figure 1. This includes adding a summing
block after the step input that also subtracts the output y. It also involves adding an
integrator after the first summing block and multiplying by the integrator gain, KI. The
output of the integrator is the input to the original summing block and the rest of the model
is the same as in lab 9. Note that both integrators should have initial conditions of zero set
in the model or in the m-file.

Figure 1: Integral control block diagram

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.

CAB Lab10.docx Page 2 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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

Cart Velocity (cm/sec)


Cart Position (cm)

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)

Figure 3: Integral control with a bad system model

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!

CAB Lab10.docx Page 3 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

poles = -5 ,-10 ,-35 and K = -0.013433, 0.014589, -0.52344


1.4 4 0.16

1.2 0.14
3
0.12

Cart Velocity (cm/sec)


1

Cart Position (cm)

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

Integral Control 2DOF Model

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.

CAB Lab10.docx Page 4 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Cart 2 Position (cm)


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

1.5 2 0.2
Cart 1 Velocity (cm/sec)

Cart 2 Velocity (cm/sec)


1.5 0.15

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

Figure 5: State feedback control of a 2DOF rectilinear system

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)

Cart 2 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)

Cart 2 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

CAB Lab10.docx Page 5 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Cart 2 Position (cm)


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

3 3 0.2
Cart 1 Velocity (cm/sec)

Cart 2 Velocity (cm/sec)


2 2 0.15

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

Full order observer state variable feedback for a 1DOF Model

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.

Figure 8: Full order observer state variable feedback structure

2. Copy the Simulink file, Basic_1dof_State_Variable_Model.mdl to the Lab 10 folder and


rename it, sv1_observer.mdl. Modify sv1_observer.mdl to implement the full order

CAB Lab10.docx Page 6 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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

Figure 9: Results for full order observer for 1DOF system

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.

CAB Lab10.docx Page 7 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

1DOF full order observer, poles = -10 , -12 opoles = -50 , -60
3 10
True True
Estimated Estimated
2.5 5

Cart Velocity (cm/sec)


2 0

Cart Position (cm)


1.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

CAB Lab10.docx Page 8 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

Full order observer state variable feedback for a 2DOF Model

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)

Cart 2 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)

Cart 2 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

Figure 13: Full order observer for a 2DOF system

CAB Lab10.docx Page 9 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Cart 2 Position (cm)


0.5
0.5
0
True True
Estimated Estimated
0 -0.5
0 0.5 1 1.5 2 0 0.5 1 1.5 2

4 4
Cart 1 Velocity (cm/sec)

Cart 2 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

CAB Lab10.docx Page 10 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

poles = -20 ,-24 ,-28 ,-32 opoles = -100 ,-120 ,-140 ,-160
1.5 1.5

Cart 1 Position (cm)

Cart 2 Position (cm)


1
1
0.5
0.5
True 0 True
Estimated Estimated
0 -0.5
0 0.5 1 1.5 2 0 0.5 1 1.5 2

15 6
Cart 1 Velocity (cm/sec)

Cart 2 Velocity (cm/sec)


10 4

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.

Type 1 Full Order Observer for a 1DOF Model

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.

CAB Lab10.docx Page 11 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lab10.docx Page 12 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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

Cart Velocity (cm/sec)


Cart Position (cm)
1 0

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

Type 1 Full Order Observer for a 2DOF 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

CAB Lab10.docx Page 13 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Cart 2 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)

Cart 2 Velocity (cm/sec)


2
2
1
1
True 0 True
Estimated Estimated
0 -1
0 0.5 1 1.5 2 0 0.5 1 1.5 2

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)

Cart 2 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)

Cart 2 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

CAB Lab10.docx Page 14 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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)

Cart 2 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)

Cart 2 Velocity (cm/sec)


True True
Estimated Estimated
2
2
1
1
0

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

CAB Lab10.docx Page 15 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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.

B. 1DOF Full Order Observer


1. Set up your 1DOF rectilinear system with 2 masses exactly as you did when you created the
model.
2. Modify the sv1_observer_driver.m to load the correct model for this 1DOF rectilinear
system.
3. Select poles to meet the design requirements. Simulate the system with a state feedback
controller and a full order observer using sv1_observer.mdl. You may need to vary the
location of the state feedback and observer poles until you get a good response.
4. Once the design has been completed, use the driver (sv1_observer_driver.m) to use the full
order observer to control the actual ECP system by simulating Model210_observer_sv1.mdl
5. 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.
6. Include the graph from the comparison in your lab memo submission.
7. Repeat part B for the 1DOF rectilinear system with 4 masses and compare the results to the
system with 2 masses

CAB Lab10.docx Page 16 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

C. Type 1 1DOF Full Order Observer


1. Copy the Model210_sv1.mdl from Lab 9 to the Lab 10 folder and rename it
Model210_observer_int_sv1.mdl. Edit this file to match the Simulink simulation file
created in the prelab for the Type 1 1DOF full order observer (sv1_observer_int.mdl) except
the ECP model 210 yellow block replaces the A and B state matrices (simulated state
model).
2. Modify sv1_observer_int_driver.m to load the correct state model for the 1DOF rectilinear
system built.
3. Select poles to satisfy the design requirements. Simulate your rectilinear system with a
state feedback controller and a full order observer, with a configuration that uses integral
control. Note that you may not be able to meet a 2 second settling time requirement. Do
not try for a particularly fast response, it will overwhelm the system! Initially put the
observer poles and the state feedback poles at the same location. Note that there will be
one more closed loop pole than observer pole. Verify that the controller does not reach its
limits! Vary the location of the state feedback and observer poles until you get a good
response.
4. Once the design has been completed, use the driver (sv1_observer_int_driver.m) for the
full order observer with integral control to drive the actual ECP system by simulating
Model210_observer_int_sv1.mdl.
5. 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.
Your system should have a near zero steady state error.
6. Include the graph from the comparison in your lab memo submission.
7. Repeat part C for the system with 4 masses and compare it to the results for the system
with 2 masses.

D. 2DOF Full Order Observer


1. Set up your 2DOF rectilinear system as you did when you created the model.
2. Copy the Model210_sv2.mdl from Lab 9 to the Lab 10 folder and rename it
Model210_observer_sv2.mdl. Edit this file to match the Simulink simulation file created in
the prelab for the Type 1 2DOF full order observer (sv2_observer.mdl) except the ECP
model 210 yellow block replaces the A and B state matrices (simulated state model).

CAB Lab10.docx Page 17 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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.

E. Type 1 2DOF Full Order Observer


1. Copy the Model210_sv2.mdl from Lab 9 to the Lab 10 folder and rename it
Model210_observer_int_sv2.mdl. Edit this file to match the Simulink simulation file
created in the prelab for the Type 1 2DOF full order observer (sv2_observer_int.mdl) except
the ECP model 210 yellow block replaces the A and B state matrices (simulated state
model).
2. Modify sv2_observer_int_driver.m to load the correct state model for the 2DOF rectilinear
system built and simulate your rectilinear system with a state feedback controller and a full
order observer, with a configuration that uses integral control.
3. Design the system to satisfy the design requirements. Initially try to place the closed loop
poles and observer poles near each other but remember that there will be on additional
closed loop pole. Do not try for a particularly fast response, it will overwhelm the system!
Select closed loop pole values between -1 and -50. Verify that the controller does not reach
its limits! Vary the location of the state feedback and observer poles until you get a good
response.
4. Once the design has been completed, use the driver (sv2_observer_int_driver.m) for the
full order observer with integral control to drive the actual ECP system by simulating
Model210_observer_int_sv2.mdl.

CAB Lab10.docx Page 18 of 19


ECE 320 Linear Control Systems Fall 2010 - 11

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

CAB Lab10.docx Page 19 of 19


     
ECE 320 Linear Control Systems  Fall 2010 ‐ 11   

 
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.

2.1 Poles and Zeros


Assume we have the transfer function
N (s)
H(s) =
D(s)

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.

2.2 Proper and Strictly Proper Transfer Functions


The transfer function
N (s)
H(s) =
D(s)

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).

2.3 Impulse Response and Transfer Functions


If H(s) is a transfer function, the inverse Laplace transform of H(s) is call the impulse response,
h(t).

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

Similarly, we will get

lim (s + p2 )H(s) = a2
s→−p2

and in general

lim (s + pi )H(s) = ai
s→−pi

Example 1. Let’s assume we have

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

h(t) = −e−2t u(t) + 2e−3t u(t)

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

where we have covered up the poles associated with a1 and a2 , respectively.

Example 2. Let’s assume we have

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

Using the cover up method, we then determine

(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

h(t) = 4e−2t u(t) − 14e−3t u(t) + 11e−4t u(t)

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

Using the coverup method, we then determine


1 1
a1 = lim =
s→−1 (s + 5) 4
1 1
a2 = lim =
s→−5 (s + 1) −4

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.

Example 4. Assume we have the transfer function


1
H(s) =
(s + 1)(s + 2)2
and we want to find the corresponding impulse response, h(t). To do this we look for a partial
fraction expansion of the form
1 1 1 1
H(s) = 2
= a1 + a2 + a3
(s + 1)(s + 2) s+1 s+2 (s + 2)2
Example 5. Assume we have the transfer function
s+1
H(s) =
s2 (s + 2)(s + 3)
and we want to find the corresponding impulse response, h(t). To do this we look for a partial
fraction expansion of the form
s+1 1 1 1 1
H(s) = = a1 + a2 2 + a3 + a4
s2 (s + 2)(s + 3) s s s+2 s+3
Note that there are always as many unknowns (the ai ) as the degree of the denominator polynomial.

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.

For Example 4, multiply though by (s + 2)2 and let s → −2,


1 1
a3 = lim (s + 2)2 2
= lim = −1
s→−2 (s + 1)(s + 2) s→−2 s+1

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.

For Example 5, using Method 1,


" # · ¸
s+1 s 1s 1 s 2 s
lim s 2 = lim a1 + 2 − +
s→∞ s (s + 2)(s + 3) s→∞ s 6s 4s+2 9s+3

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

Then for Example 4,

h(t) = e−t u(t) − e−2t u(t) − te−2t u(t)

and for Example 5

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

• Multiplying both sides by s and letting s → ∞


• Setting s to a convenient value in both sides of the equations. Both sides must remain
finite

Example 6. Assuming

s2
H(s) =
(s + 1)2 (s + 3)
determine the corresponding impulse response h(t).

First, we determine the correct form


s2 1 1 1
H(s) = 2
= a1 + a2 2
+ a3
(s + 1) (s + 3) s+1 (s + 1) s+3
Second, we determine the coefficient(s) of the distinct pole(s)

(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 .

Putting it all together, we have


5 1 9
h(t) = − e−t u(t) + te−t u(t) + e−3t u(t)
4 2 4
Example 7. Assume we have the transfer function
s+3
H(s) =
s(s + 1)2 (s + 2)2
find the corresponding impulse response, h(t).

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

Second, we determine the coefficient(s) of the distinct pole(s)


s+3 3 3
a1 = lim 2 2
= =
s→0 (s + 1) (s + 2) (1)(4) 4

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

Fourth, we determine any remaining coefficients


" # " #
s+3 3s s s s 1 s
lim s = s→∞
lim + a2 −2 + a4 −
s→∞ s(s + 1)2 (s + 2)2 4s s+1 (s + 1) 2 s + 2 2 (s + 2)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

with solution a2 = 1 and a4 = − 74 . Putting it all together we have

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:

if x(t) ⇔ X(s), then e−at x(t) ⇔ X(s + a)

To show this, we start with what we are given:


Z ∞
L{x(t)} = x(t)e−st dt = X(s)
0

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.

Example 8. Let’s assume

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

and this is the form we need.

Example 9. Let’s assume

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

and this is the form we need.

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.

Example 10. Assuming

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

This almost has the form we want, which is

(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.

Example 12. Assuming

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

To find a2 , let’s use our trick of multiplying by s and letting s → ∞


" # " #
1 1 s a2 s2 + a3 s
lim s = s→∞
lim + 2
s→∞ (s + 2)(s2 + s + 1) 3s+2 s +s+1

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

2.7 Common Denominator/Cross Multiplying


As a last method, we’ll look at a method of doing partial fractions based on using a common de-
nominator. This method is particularly useful for simple problems like finding the step response
of a second order system. However, for many other types of problems it is not very useful, since
it generates a system of equations that must be solved, much like substituting values of s will
do.
Example 13 Let’s assume we have the second order system

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.

Example 14. Find the step response of

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

In the time-domain we have then


s s
15 3 15
y(t) = u(t) − e−3t/4 cos( t)u(t) − √ e−3t/4 sin( t)u(t)
16 15 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

D(s) = [s − (−a + jb)][s − (−a − jb)]


= [s + (a − jb)][s + (a + jb)]
= s2 + [(a − jb) + (a + jb)]s + (a − jb)(a + jb)
= s2 + 2as + a2 + b2
= (s + a)2 + b2

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.

A.2 Transfer Functions


We will make extensive use of transfer functions in this course, so we need to know how to enter
them into Matlab. In general, to enter a polynomial such as

as4 + bs3 + cs2 + ds + e

into Matlab, type

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

num = [1 0 2 0]; den = [1 3 0 1 5];

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

We first need to define all of the transfer functions


Gpre = tf([1 1],[1 2 3]);
Gc = tf(10,[1 0]);
Gp = tf([1 0 2],[1 2 0 1]);
H = tf(1,[1 1]);
Next, we compute the transfer function for the feedback block using the feedback command
T = feedback(Gc*Gp,H);
Finally we add the prefilter to get the close loop transfer function
G0 = Gpre*T;

A.4 System Response to Arbitrary Inputs


We will make extensive use both the unit step response and the unit ramp response of a system
in this course. For the unit step response, we assume the system is at rest and the input is
u(t) = 1 (a constant) for all t ≥ 0, while for the unit ramp response, we assume the system is
at rest and the input is u(t) = t for all t ≥ 0.

The simplest way to determine the step response to a system is


step(H);
A figure will appear on the screen, with the step response of the system. Note that the system
will determine what it thinks are appropriate parameters. Sometimes, we want more control
and want different inputs other than a step. In that case we use the command lsim. There
are many forms for this command. In its basic form, you need to tell it a transfer function, the
input function ‘u’, and the sample times ‘t’. For example, the following sequence of commands
plots the response of the system
1
H(s) =
s2 + 2s + 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.

num=[1]; den=[1 2 1];


H = tf(num,den); % get the transfer function
t=[0:0.05:100]; % times from 0 to 100 seconds by increments of 0.05
u = cos(3*t); % input is cos(3t) at the sampe times
y=lsim(H,u,t); % system output is y
plot(t,y); % plot the output

We can (obviously) use the lsim command to determine the step response,

num=[1]; den=[1 2 1];


H = tf(num,den); % get the transfer function
t=[0:0.05:100]; % times from 0 to 100 seconds by increments of 0.05
nt = length(t); % get the length of the t array
u = ones(1,nt); % input is a sequence of 1’s
y=lsim(H,u,t); % system output is y
plot(t,y); % plot the output

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

A.5 Changing the Line Thickness


As you hopefully have figured out, Matlab allows you to chose the colors for your graphs.
However, sometimes you do not have access to a color printer, or just want to do something
different. The following section of code allows you to plot using different line thicknesses.

%
% 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.

A.6 Poles and Zeros


For any transfer function, the poles of the system are the roots of the denominator polynomial,
while the zeros of the system are the roots of the numerator polynomial. Hence, if we have a
transfer function
(s + 1)(s − 1)
G(s) =
(s + 2)2 (s + 3)(s + 4)

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.

A.7 Roots and Polynomials


If we want the roots of a polynomial Q assigned to a variable r , we would use the Matlab
command roots

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);

and we would get an array

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

Q = poly([0.3412+1.1615*i 0.3412-1.1615*i -0.6823]);

iv
or, in our case

Q = poly(r);

or

Q = poly([ r(1) r(2) r(3) ]);

If we want to polynomial with roots at 0.3412 ± 1.1615j, −0.6823 we can just type

Q = poly([ r(1) r(2) ]);

A.8 Root Locus Plots


To plot the root locus of a system with open loop transfer function H(s), we use the rlocus
command,

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)

A.9 Bode Plots, Gain and Phase Margins


To determine the gain and phase margin of a system with open loop transfer function H(s), we
use the margin command

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

w = logspace(0,2,100); % create 100 logarithmically spaced points


% between 1 (10^0) and 100 (10^2)
bode(H,w);

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 ( )
( )

rise time Tr = ln(9)

settling time Ts = - ln(.02)

Second-order system ( )

rise time

settling time

peak time √

percent overshoot √

( ⁄ )
damping ratio
√ ( ⁄ )

s-plane pole plot radius √

s-plane pole plot damping ratio

Steady-State Error

step ( )

ramp ( )

parabola ( )

CAB ECE320_Formula Sheet.docx 1


Root Locus

magnitude criterion | ( ) ( )|

angle criterion ( ) ( ) ( ) , k = 0, 1, 2, …

( )
asymptotic angles
= n – m = # of poles - # of zeros

∑ ∑
Centroid of the asymptotes

Breakaway and Entry Points ( ) ( ) ( ) ( )

Frequency Response

sensitivity ( ) | |

bandwidth √ √

( )( )
PID Controller ( )

( )
PI Controller ( ) ⁄

PD Controller ( ) ( )

phase margin
√ √

Nyquist criterion Z=N+P


( ) ( ) ( )
Lag compensator ⁄( )

Gain = (1 + sin )/(1 - sin )

Lead compensator ⁄
( ) ( ) ( )
⁄( )

CAB ECE 320 Formula Sheet.docx 2


( ) ( )( )

Lag-Lead compensator ⁄ ⁄
( )( )
⁄( ) ⁄( )
0< < 1, > 1, = 1/

max phase angle  ( )

frequency at max phase angle


magnitude at maximum phase angle | ( )|


State Space Design


̇
Plant representation
y = Cx

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 [ ̇] [ ][ ]
̃ ̃

CAB ECE 320 Formula Sheet.docx 3


̇
[ ̇] [ ]* + [ ]
Type 1 integrated state variable feedback with full ̂̇ ̂
order observer ̇
[ ̇] [ ]* + [ ]
̃̇ ̃
2 n-1
Controllability Matrix CM = [B AB A B … A B]

Observability Matrix [ ]

CAB ECE 320 Formula Sheet.docx 4

S-ar putea să vă placă și