Vous êtes sur la page 1sur 18

# ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 1

Solution to HW7
AP8.4 We are given the forward and feedback path transfer functions for a unity negative
feedback system. The forward path transfer function is
1
G(s) =
s2 + 3.2s + 16
and the feedback path transfer function is
1
H(s) = .
0.5s + 1
We are asked to sketch the Bode diagram for G(s)H(s).
Solution: First we find the corner frequencies . For H(s) we have a pole at s = 2,
hence a corner at = 2 and for G(s) we have n = 4 and = 3.2/(2n ) = 0.4. Thus for
the complex pole pair, q
r = n 1 2 2 = 3.2
and
1
Mp = |G(r )| = p = 1.36.
2 1 2
To determine the magnitude for low frequencies, we must rewrite the transfer function as
1/16
G(s)H(s) = .
(s2 /16 + 3.2s/16 + 1)(s/2 + 1)
Then for frequencies below = 2 we have horizontal asymptote |G()H()| = 20 log 10 (1/16) =
24 dB. From = 2 to = 4 our asymptote has a slope of 20 dB/decade. Superimposed
on this is a peak of height 20 log 10 (Mp ) about r . Beyond = 4, we have asymptotic
slope 60 dB/decade since there are a total of three poles. For the phase plot, we have an
asymptote that decreases from 0 to 90 degrees over the frequency range 2/10 to 2 10
rad/s (2 decades centered at = 2 rad/s). Another goes from 90 to 180 over the
range 4/10 to 4 10 rad/s (2 decades centered at = 4 rad/s). We add these to get the
asymptotic phase curve which goes from zero degrees at frequencies below = 2/10 to
270 degrees at = 4 10 and above.
From this information we could generate the plots by hand. The exact magnitude and
phase curves generated by Matlab are shown in Figure 1. The transcript of the Matlab
session is given below.

## >> GH = tf([1/16],conv([1/16 3.2/16 1],[1/2 1]))

Transfer function:
0.0625
------------------------------------
0.03125 s^3 + 0.1625 s^2 + 0.7 s + 1

## >> bode(GH); grid;

>> title(Magnitude and Phase Plots for AP8.4)
>> print -deps ap8_4.eps
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 2

## Magnitude and Phase Plots for AP8.4

20

30

40

50
Magnitude (dB)

60

70

80

90

100

110

120
0

90
Phase (deg)

180

270
2 1 0 1 2
10 10 10 10 10
Frequency (rad/sec)

## AP8.5 We are given the closedloop transfer function

10(s + 1)
T (s) =
s2 + 9s + 10
for a unity feedback system and asked to find the openloop transfer function, generate
a logmagnitudephase plot, and determine whether the open and closedloop systems
are stable.
Solution: The answers to these questions depend upon whether we assume negative
feedback or positive feedback. Probably the authors intended to use negative feedback.

## (a) Assuming negative feedback we have

G(s)
T (s) =
1 + G(s)
so
10(s + 1)
G(s) = (1 + G(s))
s2 + 9s + 10
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 3

then  
s2 + 9s + 10 G(s) = 10(s + 1) (1 + G(s))
and solving for G(s) yields
10(s + 1)
G(s) = .
s(s 1)
If we assume positive feedback, we would similarly obtain
10(s + 1)
G(s) = .
s2 + 19s + 20
(b) The logmagnitudephase plots for the three transfer functions are given in Figure 2.
In the plot legend, NF stands for negative feedback and PF stands for positive
feedback. The Matlab script that generated this figure is given below.
clsys = tf([10 10],[1 9 10]);
olsysn = tf([10 10],[1 -1 0]);
olsysp = tf([10 10],[1 19 20]);
w = logspace(-1,3,1000);
[magc,pc,wc] = bode(clsys,w);
[magon,pon,won] = bode(olsysn,w);
[magop,pop,wop] = bode(olsysp,w);
plot(squeeze(pc),20*log10(squeeze(magc)))
hold on
plot(squeeze(pon),20*log10(squeeze(magon)),--)
plot(squeeze(pop),20*log10(squeeze(magop)),-.)
legend(Closed-Loop,Open-Loop, NF,Open-Loop, PF)
a = find(wc >= 1);
b = find(wc >= 10);
c = find(wc >= 50);
d = find(wc >= 110);
e = find(wc >= 500);
omega_index = [a(1) b(1) c(1) d(1) e(1)]
wc(omega_index)
for index = omega_index,
plot(pc(1,1,index),20*log10(magc(1,1,index)),xr)
plot(pon(1,1,index),20*log10(magon(1,1,index)),xr)
plot(pop(1,1,index),20*log10(magop(1,1,index)),xr)
end;
title(Log-Magnitude-Phase Plot for AP8.5b)
xlabel(Phase (deg))
ylabel(Magnitude (dB))
grid
print -depsc ap8_5.eps

(c) The poles of the given closedloop system are 1.3 and 7.7 so the closedloop system
is stable. If we assume negative feedback, the openloop system obtained has a pole
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 4

## Figure 2: Plot generated by Matlab for AP8.5

LogMagnitudePhase Plot for AP8.5b
40
ClosedLoop
OpenLoop, NF
30 OpenLoop, PF

20

10
Magnitude (dB)

10

20

30

40

50
100 50 0 50 100 150 200 250 300
Phase (deg)

in the righthalf plane, hence is unstable. If we assume positive feedback, the poles
are 1.12 and 17.88, hence stable.

DP8.2 We are given a negative unity feedback system with a controller preceding the plant in
the forward path. The controller transfer function is G c (s) = K(s + 1)/(s + 5) and the
plant transfer function is
1
G(s) = 2
.
s(s + 2s + 10)
We are asked to sketch the Bode diagrams for the open and closedloop transfer functions
when K = 20. We are then asked to determine the frequencies for which the gain is 0
dB and for which the phase is 180 degrees in the openloop case. Next, we are asked to
determine Mp , r and B for the closedloop transfer function for two different values of
the gain, K = 20 and K = 40. Finally, we are asked to choose the one of these gains that
gives the shortest settling time while keeping the overshoot in response to a step input less
than 35%.
Solution:
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 5

## (a) With K = 20, the openloop transfer function is

20(s + 1) 20(s + 1)/50
Gc (s)G(s) = 2
=
s(s + 5)(s + 2s + 10) s(s/5 + 1)(s2 /10 + 2s/10 + 1)
which yields a corner frequency of = 1 for the real zero, another of = 5 for
the real pole
at s = 5 and another at n =p 10 due to the complex pole pair.
With = 1/ 10 = 0.32 we find Mp = (2 1 2 )1 = 1.67. We could now
use asymptotes to draw the Bode diagram. The magnitude plot would have slope
20dB/decade for < 1, value 0+20 log 10 (2/5) at = 1 and slope of 60 dB/decade
for large . The phase plot would start at 90 degrees (due to the pole at the origin),
increase due to the zero at s = 1, and decrease due to each of the poles to 270
degrees for large . From the Bode plot we determine that the gain is 0 dB at
approximately = 0.4 rad/s and the phase is 180 degrees at approximately = 4
rad/s. (For the exact values, see the output of the margin command in the transcript
below.) The Bode plot is given in Figure 3.
(b) The closedloop transfer function is
Gc (s)G(s) 20s + 20 s+1
T (s) = = 4 = 4
1 + Gc (s)G(s) s + 7s3 + 20s2 + 70s + 20 s /20 + 7s3 /20 + s2 + 7s/2 + 1
which has poles 5.55, 0.57 3.36j, and 0.31. The Bode plots generated for the
closedloop transfer function using Matlab are shown in Figure 3.
The transcript of the commands that generated this plot is given below.
>> K = 20;
>> olsys = tf(K*[1 1],conv([1 5 0],[1 2 10]))

Transfer function:
20 s + 20
---------------------------
s^4 + 7 s^3 + 20 s^2 + 50 s

## >> clsys = feedback(olsys,1)

Transfer function:
20 s + 20
--------------------------------
s^4 + 7 s^3 + 20 s^2 + 70 s + 20

## >> [mag,phase,w] = bode(olsys);

>> [Gm,Pm,Wcg,Wcp] = margin(mag,phase,w)

Gm =

3.1772
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 6

Figure 3: Bode plot generated by Matlab for Problem DP8.2, parts (a) and (b)
Magnitude and Phase Plots for DP8.2
50

0
Magnitude (dB)

50

100
0 OpenLoop
ClosedLoop

90
Phase (deg)

180

270
2 1 0 1 2
10 10 10 10 10
Frequency (rad/sec)

Pm =

103.6808

Wcg =

4.0269

Wcp =

0.4433

## >> 20*log10(Gm) %% gain margin in dB

ans =
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 7

10.0410

## >> bode(olsys,-,clsys,-.); grid;

>> title(Magnitude and Phase Plots for DP8.2)
>> legend(Open-Loop,Closed-Loop)
>> print -deps dp8_2.eps
(c) To determine Mp and r , we must factor the denominators of the closedloop transfer
functions obtained for K = 20 and K = 40. We then identify the complex pole
pairs and use the Matlab command poly to obtain the second order polynomial
corresponding to the complex pole pair. Identifying the polynomial with s 2 +2n s+
n2 allows us to easily compute for each case. We then use equations (8.36) and
(8.37) from the text to compute r and Mp , respectively. For the case K = 20,
we find r = 3.31 and Mp = 3.04. For the case K = 40, we find r = 3.68 and
Mp = 7.04.
To determine the bandwidths, we plot the Bode diagrams for both cases, as shown
in Figure 4. We notice that for both cases, the magnitude dips more than 3 dB
below the low frequency value before the peak occurs, so that if we automated the
bandwidth search procedure we would have to exercise caution to identify the 3
dB point after the peak rather than the one before. Clicking on points on the Bode
plots to determine the values leads us to conclude that the bandwidth for the case
K = 20 is approximately 3.5 rad/s whereas the bandwidth for the case K = 40 is
approximately 4.6 rad/s. The transcript of the session that generated the required
values and the Bode plots if given below.

>> K = 40;
>> olsys2 = tf(K*[1 1],conv([1 5 0],[1 2 10]))

Transfer function:
40 s + 40
---------------------------
s^4 + 7 s^3 + 20 s^2 + 50 s

## >> clsys2 = feedback(olsys2,1)

Transfer function:
40 s + 40
--------------------------------
s^4 + 7 s^3 + 20 s^2 + 90 s + 40

## >> [num2,den2] = tfdata(clsys2,v)

num2 =

0 0 0 40 40
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 8

Figure 4: Bode plots generated by Matlab for Problem DP8.2, part (c)
Magnitude and Phase Plots for DP8.2, part (c)
50

0
Magnitude (dB)

50

100

150
0 K=20
K=40

90
Phase (deg)

180

270
2 1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)

den2 =

1 7 20 90 40

## >> poles2 = roots(den2)

poles2 =

-5.9844
-0.2632 + 3.6872i
-0.2632 - 3.6872i
-0.4891

>> [num,den]=tfdata(clsys,v)

num =
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 9

0 0 0 20 20

den =

1 7 20 70 20

## >> poles = roots(den)

poles =

-5.5518
-0.5689 + 3.3590i
-0.5689 - 3.3590i
-0.3104

p1 =

p2 =

zeta1 =

0.1670

## >> zeta2 = p2(2)/2/sqrt(p2(3))

zeta2 =

0.0712

>> wn1=sqrt(p1(3))

wn1 =

3.4068
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 10

>> wn2=sqrt(p2(3))

wn2 =

3.6966

wr1 =

3.3105

wr2 =

3.6778

Mpw1 =

3.0367

Mpw2 =

7.0394

## >> bode(clsys,-,clsys2,-.); grid

>> title(Magnitude and Phase Plots for DP8.2, part (c))
>> legend(K=20,K=40);
>> print -depsc dp8_2c.eps

(d) Here we plot the step responses, shown in Figure 5, for the transfer functions corre-
sponding to the two gains. The peak overshoot is less than 35% in both cases. We see
that the settling times appear to be identical, so to check more carefully, we isolate
the segment of the step response between 98% and 102% of the final value. This is
shown in Figure 6, which indicates that the 2% settling times are essentially identical,
whereas the K = 20 system has a shorter 1% settling time than the K = 40 system.
If we are only concerned with the settling time we would choose K = 20. Otherwise,
if the rise time were the most important remaining factor in determining our choice
of K we would choose the faster system with K = 40 but if large oscillations were
undesirable we would tend to choose the slower system with K = 20. The Matlab
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 11

## script used is included below.

Figure 5: Step responses generated by Matlab for Problem DP8.2, part (d)
Step responses for DP8.2
1.4
K=20
K=40

1.2

0.8

0.6

0.4

0.2

0
0 5 10 15 20 25 30
Time (s)

## K = 20; olsys = tf(K*[1 1],conv([1 5 0],[1 2 10]))

clsys = feedback(olsys,1)
K = 40; olsys2 = tf(K*[1 1],conv([1 5 0],[1 2 10]))
clsys2 = feedback(olsys2,1)
t = [0:.01:30];
y = step(clsys,t);
y40 = step(clsys2,t);
figure(13);
plot(t,y,t,y40,-.);grid;
title(Step responses for DP8.2),
xlabel(Time (s));
legend(K=20,K=40);
print -deps dp8_2d1.eps
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 12

Figure 6: Close-up of step responses generated by Matlab for Problem DP8.2, part (d)
Closeup Plot, DP8.2 Step Response
1.025
K=20
K=40
1.02

1.015

1.01
Truncated Response

1.005

0.995

0.99

0.985

0.98
0 5 10 15 20 25 30
Time (s)

## for index = 1:3001,

test1(index) = min(max(y(index),.98),1.02);
test2(index) = min(max(y40(index),.98),1.02);
end;
figure(15);
plot(t,test1,t,test2);
title(Close-up Plot, DP8.2 Step Response);
xlabel(Time (s));
ylabel(Truncated Response);
legend(K=20,K=40);
print -deps dp8_2d2.eps

DP8.4 We are given a negative unity feedback system with a controller preceding the plant in
the forward path. The controller transfer function is G c (s) = K( s + 1)/(s/10 + 1) and
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 13

## the plant transfer function is

1
G(s) = .
(s/2 + 1)2
We are asked to select a gain K and a controller constant so that the bandwidth of the
closedloop system is maximized subject to the constraining M p < 1.5, and to determine
the bandwidth achieved using the selected values.
Solution: First, lets invert the expression for M p in terms of to find the range of s
that correspond to Mp 1.5.

1
M p = p 1.5
2 1 2

holds if q
1 1.5(2) 1 2.
Squaring both sides and rearranging terms we determine that the condition is equivalent
to 4 2 + 1/9 0, so solving the quadratic yields the constraint 0.3464 < < 0.9327.
Next, we will apply a twostep root locus procedure (following the method of section 7.5,
pp. 354359 of the text) to the closedloop transfer function

Gc (s)G(s) K( s + 1)
T (s) = = .
1 + Gc (s)G(s) (s/10 + 1)(s/2 + 1)2 + K( s + 1)

## We will work with this last version.

Dividing both sides of

## by s3 + 14s2 + 44s + 40(1 + K) yields

40K s
1+ = 0. (1)
s3 + 14s2 + 44s + 40(1 + K)

We then apply the root locus procedure to the denominator of the second term. Dividing
both sides of
s3 + 14s2 + 44s + 40(1 + K) = 0
by s3 + 14s2 + 44s + 40 yields
40K
1+ = 0.
s3 + 14s2 + 44s + 40
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 14

## Figure 7: Root locus plot generated by Matlab for K in Problem DP8.4,

Root Locus for Gain K in DP8.4
20

15

System: untitled1
Gain: 13.9
10 Pole: 0.0212 + 6.54i
Damping: 0.00324
Overshoot (%): 99
Frequency (rad/sec): 6.54

5
Imaginary Axis

10

15

20
30 25 20 15 10 5 0 5 10
Real Axis

The root locus for this equation in shown in Figure 7, and the limiting value for the gain
K is determined by finding the value of K for which the loci cross the imaginary axis.
This yields an upper bound on K for the system to remain stable. We choose K = 13.9,
corresponding to poles at 0.0212 6.54j (slightly to the left of the imaginary axis).
Now we substitute the value K = 13.9 into (1) to obtain
40(13.9) s
1+ = 0.
s3 + 14s2 + 44s + 40(13.9)
The root locus for is now shown in Figure 8. We will achieve a larger bandwidth when
we have a larger r so we choose = 0.35 near the lower bound on . We choose a point on
the root locus where the damping is approximately 0.35 and find that the corresponding
gain is 0.483, so we select = 0.48. The resulting closedloop transfer function is then
(13.9)(48s/100 + 1)
T (s) = .
(s/10 + 1)(s/2 + 1)2 + 13.9(48s/100 + 1)

To verify that we have met our design objectives we generate the Bode plot shown in
Figure 9 using the following commands.
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 15

## Figure 8: Root locus plot generated by Matlab for in Problem DP8.4,

Root Locus for Gain in DP8.4
50

40

System: untitled1
30
Gain: 0.483
Pole: 5.95 + 15.9i
Damping: 0.35
20 Overshoot (%): 30.9
Frequency (rad/sec): 17

10
Imaginary Axis

10

20

30

40

50
14 12 10 8 6 4 2 0
Real Axis

## bode(tf(13.9*[48/100 1],[0.025 0.35 1.1+13.9*48/100 13.9] )); grid;

title(Bode Diagram for Closed-Loop Transfer Function DP8.4 with ...
\tau=0.48 and K=13.9);

By clicking on the plot we find that the peak value of the magnitude plot is approximately
2.86 dB, which is within 20 log 10 (1.5) = 3.52 dB of the low frequency value 0 dB at = 0.1
rad/s. Similarly, we find that B is approximately 23.2 rad/s.

MP8.5 We are given a unity negative feedback system in which the controller with transfer
function Gc (s) precedes the plant, whose transfer function is G(s), in the forward path.
We are asked to obtain Bode plots of both the open and closedloop transfer functions for
this system.
Solution: The magnitude and phase plots are shown in Figure 11.
A transcript of the Matlab commands that generated the plots is shown below.

## >> Gc = tf(,[1 1]);

>> G = tf(,[1 3 1]);
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 16

## Figure 9: Bode plot generated by Matlab for Problem DP8.4,

Bode Diagram for ClosedLoop Transfer Function in DP8.4 with = 0.48 and K = 13.9
20

10

0
System: untitled1
System: untitled1
10 Frequency (rad/sec): 0.103 Frequency (rad/sec): 23.2
Magnitude (dB): 0.0015
Magnitude (dB)

## Magnitude (dB): 3.01

20

30

40

50

60

70

80
0

45
Phase (deg)

90

135

180
1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)

## >> olsys = series(Gc,G)

Transfer function:
10
---------------------
s^3 + 4 s^2 + 4 s + 1

## >> clsys = feedback(olsys,1)

Transfer function:
10
----------------------
s^3 + 4 s^2 + 4 s + 11

## >> bode(olsys,-,clsys-.); grid;

>> title(Magnitude and Phase Plots for MP8.5)
>> legend(Open-Loop,Closed-Loop)
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 17

Figure 10: Magnitude and Phase Plots generated by Matlab for Problem MP8.5
Magnitude and Phase Plots for MP8.5
20

20
Magnitude (dB)

40

60

80

100
0 OpenLoop
ClosedLoop

90
Phase (deg)

180

270
2 1 0 1 2
10 10 10 10 10
Frequency (rad/sec)

## >> print -depsc mp8_5.eps

MP8.6 We are given the forward path transfer function for a unity negative feedback system.
The forward path transfer function is
1
G(s) = .
s(s + 2p)

We are asked to use Matlab to plot the bandwidth vs. the parameter p for 0 < p < 1.
Solution: The closedloop transfer function is
1
G(s) = ,
s2 + 2ps + 1
which corresponds to n = 1 and = p.
The following script Matlab script generates the requested plot, which is given in Fig-
ure 11.
ECE382/ME482 Spring 2004 Homework 7 Solution April 4, 2004 18

p = [0:0.001:1];
w = logspace(-1,1,2000);
num = 1;
for index = 1:length(p),
den = [1 2*p(index) 0];
clsys = feedback(tf(num,den),1);
[mag,phase,w] = bode(clsys,w);
a = find(mag<0.707);
wb(index) = w(a(1));
end;
figure(10)
plot(p,wb);grid;
xlabel(p)
ylabel(Bandwidth \omega_b (rad/s))
title(Plot for MP8.6)
print -deps mp8_6.eps

Figure 11: Plot of system bandwidth vs. value of p for Problem MP8.6
Plot for MP8.6
1.6

1.5

1.4

1.3
Bandwidth (rad/s)

1.2
b

1.1

0.9

0.8

0.7

0.6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
p