Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS...

7

Click here to load reader

Transcript of Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS...

Page 1: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion. (Type “help residue” at the MATLAB prompt for more info.) Below are some useful Laplace transforms and MATLAB commands which will find the required solutions.

f(t) F(s) 1 )(tδ (unit impulse) 1 2 )(tu (unit step)

s1

3 )(tut n 1

!+ns

n

4 )(tue tλ λ−s

1

5 )(tuet tn λ 1)(

!+− ns

6a )()sin()cos( tut

ABtAe d

dd

t

−+− ω

ωσ

ωσ

where: 22 σωω −= nd

22 2 nssBAs

ωσ +++

6b )()cos( tutKe dt φωσ +−

where: 22 σωω −= nd 2

2)(

−+⋅=

d

ABAAsignK

ωσ

−=

−−= −−

d

d ABAAB

ωσωσ

φ)(

tan/)(

tan 11

22 2 nssBAs

ωσ +++

For all cases, the transfer function from input to output is: 162

1)()(

2 ++=

sssUsY

a) unit impulse (row 1): 1)( =sU a , so 162

1)(

2 ++=

sssYa

b) step of magnitude A (row 2): sA

sU b =)( , so )162(

)(2 ++

=sss

AsYb

c) unit parabola ( 2t ) (row 3):3

2)(

ssU c = , so

d) unit cosine (row 6a): 22

)(n

c ss

sUω+

= , so )162)((

)(222 +++

=sss

ssY

nd ω

) 16 2 ( 2

) ( 2 3 + +

= s s s

s Y c

Page 2: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

Problem 1 (continued)

a) 162

1)(

2 ++=

sssYa Using row 6a, )sin(

1)( tety d

d

ta ω

ω−= ,

where 873.3116 2 =−=dω (rad/s). )873.3sin(2582.0)( tety ta

−= Below are MATLAB commands. Note that the semicolon allows me to separate

multiple commands to put them on a single line (just to save space!):

0 2 4 6-0.1

0

0.1

0.2

0.3

time (s)

y a(t)

my equationMATLAB impulse

I’ve intentionally introduced the MATLAB functions “impulse” and “tf” above, which you should become familiar with, if you haven’t already used them. (Use “help impulse” and “help tf”.) I’ve plotted my own solution against MATLAB’s here as a check.

b) )162(

)(2 ++

=sss

AsYb . First, we expand via partial fraction (using MATLAB), using

A=1 and then scaling every as necessary. MATLAB commands are shown below, at right, and give the following partial fraction expansion:

+

++−−

=sss

sAYb

0625.162125.0625.

2

Let’s double-check this expansion in MATLAB:

>> tau=1; t=6*tau*[0:.001:1]; >> figure(1); clf >> plot(t,(1/sqrt(15))*exp(-t./tau).*sin(sqrt(15)*t),'b-') >> grid on; xlabel('time (s)'); ylabel('y_a(t)') >> hold on >> [ya,ta]=impulse(tf([1],[1 2 16]),t); >> p1=plot(ta,ya,'r-.') >> set(p1,'LineWidth',2) >> legend('my equation','MATLAB impulse')

>> [r,p]=residue([1],[1 2 16 0]) r = -0.0313 + 0.0081i -0.0313 - 0.0081i 0.0625 p = -1.0000 + 3.8730i -1.0000 - 3.8730i 0 >> num=r(1)*[1 -p(2)] + r(2)*[1 -p(1)] num = -0.0625 -0.1250 >> den=conv([1 -p(1)],[1 -p(2)]) den = 1.0000 2.0000 16.0000

>> tf1=tf(num,den) Transfer function: -0.0625 s - 0.125 ----------------- s^2 + 2 s + 16 >> tf2=tf(r(3),[1 0]) Transfer function: 0.0625 ------ s

>> tf1+tf2 Transfer function: 1 ------------------ s^3 + 2 s^2 + 16 s

Page 3: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

Using row 2 (unit step) and either row 6a or 6b, we can find the total time response:

0 2 4 6

0

0.02

0.04

0.06

0.08

0.1

time (s)

y b(t)/A

my equationMATLAB step

(c) )162(

2)(

23 ++=

ssssYc This can be expanded into:

)162(512143

5123

641

81

)(223 ++

++−−=

sss

ssssYc . Using rows 2, 3 and 6:

)7580.873.3cos(0080687.0512

3641

161

)( 2 −+−−= − tettty tc

0 2 4 60

0.5

1

1.5

2

2.5

time (s)

y c(t)

my equationMATLAB

0 10 20 30 40 500

50

100

150

time (s)

y c(t)

my equationMATLAB

(Approaches a parabolic response as t goes to infinity.)

(d) )162)((

)(222 +++

=sss

ssY

nd ω

or )162()(

)(222 ++

++

++

=ss

DCss

BAssYd ω

,

where )25628(

)16(24

2

+−−

=ωω

ωA ,

)25628(2

24

2

+−=

ωωω

B , )25628(

)16(24

2

+−−

=ωω

ωC ,

and)25628(

3224 +−

−=

ωωD . Using row 6a,

+++= − )873.3sin(873.3

)873.3cos()sin()cos()( tCD

tCetB

tAty td ω

ωω

Your plot will depend on your choice of ?. I ’ve plotted several options on the next page. (Note the time scales and y-axes are different, in general, from one to the next!)

[ ]

−+=

−−=

)873.3sin(0161.0)873.3cos(0625.0161

)2527.0873.3cos(0645.0161

)(

tteA

teAty

t

tb

Page 4: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

0 2 4 6-0.2

-0.1

0

0.1

0.2ω = 4 (rad/s)

time (s)

y d(t

)

my equationMATLAB

0 10 20 30-0.1

-0.05

0

0.05

0.1ω = 0.5 (rad/s)

time (s)

y d(t

)

my equationMATLAB

0 2 4 6-0.01

-0.005

0

0.005

0.01

time (s)

y d(t)

ω = 16 (rad/s)

my equationMATLAB

0 1 2 3-4

-2

0

2

4

6x 10

-4

time (s)

y d(t)

ω = 64 (rad/s)

my equationMATLAB

Problem 2 (Nise 2.8, plus find y(t)) – Only ‘c’ was tricky, and you can use MATLAB to help with that partial fraction expansion. (No, it does not factor “nicely”, I know.)

a) 72

1)()(

2 ++=

sssFsX

diff eq is: )(72 tfxxx =++ &&& Partial fraction expansion for X(s),

given a unit step in f(t) is:

+++

−=72

2171

)( 2 sss

ssX

[ ] )3876.45.2cos(1543.71

)3876.6cos(0801.1171

)( −−=−−⋅= −− tetetx tt

I sorta like the form on the lefthand side more, because you’ll generally expect to see something like the “static gain” (when all derivatives have gone to zero, x=(1/7) of f) times the quatity “1 minus a cosine with frequency given by the “damped natural frequency” and with an amplitude somewhat greater than one and a phase shift between zero and negative pi/2”.

b) )8)(7(

10)()(

++=

sssFsX

diff eq is: )(105615 tfxxx =++ &&& Partial fraction expansion for

X(s), given a unit step in f(t) is: )8(8

10)7(7

105610

)(+

++

−=ss

sX . Using row 4:

tt eetx 87

810

710

5610

)( −− +−= Note the slope is zero at t=0. (Take a derivative…)

Page 5: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

c) 1598

2)()(

23 ++++

=sss

ssFsX

diff eq is: )(2)(

15982

2

3

3

tfdt

tdfx

dtdx

dtxd

dtxd

+=+++ Partial

fraction expansion is not pretty (again, given a step input in f(t)):

136.29774.0334.1494.

0226.7016.

152

)(2 ++

+−

++=

sss

sssX

)1903.3774.1cos(1521.016.152

)( 4887.0226.7 +−+= −− teetx tt I can only believe my math

here, because the plot checks out against a MATLAB step response! Problem 3 – Ship roll stabilization If we tap a boat that is floating in the water, we expect its response to show decaying sinusoidal oscillations. This suggests that a 2nd-order model may be appropriate. The boat has some effect inertia, J. Viscous damping (B) can be explained from the losses causes as various parts of the boats “swish” through the water, and the offset of the centers of buoyancy and gravity due to any “tilt” provide a spring force (K, which we can model as a linear spring, very similar to the spring effect of a pendulum for small theta). Input torques will come both from our commanded input torque T, applied by the fins, and from any disturbance torques, Td. The output will be the angle of the boat’s tilt, ? :

din TTKBJ +=++ θθθ &&& . The transfer function from commanded input torque to output

theta is: KBsJssT

s++

2

1)()(

.

-5 0 5 10

-0.1

-0.05

0

0.05

0.1

time (seconds)

Boa

t tilt

, in

RA

DIA

NS

Boat test: Tin of 10 Nm applied until s.s., then released at t=0

K=Tin/θss=10/.1=100τ = 2 sec

2π/ωd=2.89 sec

ωn ≈ 2.2 rad/s

J ≈ K/ωn2 = 20

B ≈ 2J/τ = 20

Page 6: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

To find J, B and K: (1) Apply a known torque to the boat and measure the steady-state

offset angle. K is the ratio “torque/angle” (Nm/rad). ss

inTK

θ= Then, we can find J and B

by giving the boat a “tap” (i.e. at impulse), or by suddenly releasing our constant input torque (i.e. a step). From the damped natural frequency and decay envelope, we should be able to get estimates for J and B. Practically speaking, the undamped natural frequency is pretty darn close to the damped natural frequency if we can actually see at least of couple of oscillations (zeta less than .2 or so), so JKd /≈ω or 22 // dn KKJ ωω ≈= . If the decay envelope has a time constant “t ” (in seconds), then define τσ /1= , and note that

JB

21

=σ (this is the negative of the real part of the pole-pair) or τ

σJ

JB2

2 == .

Problem 4 – Transfer function for an over controller

We know electrical power is RE

EIQ2

== . To approximate the relationship between the

input, E, to the desired output, T , with a “transfer function”, we first need to linearize the relationship between E (voltage) and Q (power in) about the given operating point, Eo.

0 1 2 30

0.2

0.4

0.6

0.8

1

E (volts)

Q =

E2 /1

0

The diagram above uses an arbitrary example resistance of 10 Ohms and an arbitrary choice of Eo=2 volts. In the region near the operating point, a linearized relationship between E and Q is: )()/( 2

oo EEmREQ −+≈ , where the slope is found by evaluating

the derivative of R

E 2

at the operating point, Eo. 4.0102

22 ===RE

m o .

So for this particular example : REEREEEREREQ oooooin /)/(2))(/(2)/( 2222 −=−+≈ .

Therefore: R

EE

RE

QKdtd

C ooin

2

2 −

≈=+ θ

θ.

To get the transfer function from the PARTICULAR INPUT “E” to the output theta, we want a linear, constant-coefficient differential equation with no additional “constants”,

“offsets”, “inputs” or whatever other names you like. Then: ERE

Kdtd

C o

=+ 2θ

θ, and

finally: KCsRE

sEs o

+=

Θ /2)()(

Page 7: Problem Set 2 SOLUTIONS - MITweb.mit.edu/2.14/www/PSets/pset_2s.pdf · Problem Set 2 SOLUTIONS Problem 1 – The MATLAB command “residue” can perform partial fraction expansion.

Problem 5 – effect of a zero on the time response Section 4.8 in Nise (“Nise” rhymes with “ice”, btw, according to the publisher) discusses just this example! What we are looking for here is a range of values for which the zero has a significant impact on the total response. Doing a partial fraction expansion:

+

++

+−

++

−+

+=

+++

sz

sz

sz

ss

ss

Kss

zsK 5.02

5.0121)2)(1(

)(

Here, the two lefthand terms with “s” in the numerator represent the “effect of the zero” on the step response. The three remaining terms are all weighted by “z”, while those two lefthand terms are not. For the three righthand terms to “dominate” over any effects from the zero, a general rule is to have the zero roughly 10x further away from the origin that the pole(s). figure(1); clf tau_list=[2 1 .5 .2 .1 .01 .001]; legval='legend('; for n=1:length(tau_list) step(tf(2*[tau_list(n) 1],[1 3 2])); hold on legval=[legval '''tau=1/z=' num2str(tau_list(n)) ''',']; end legval=[legval '4);']; eval(legval) grid on This MATLAB code generates the plot at right. The step responses have all been normalized here to have the same steady-state value, 1. by z=10 or so, the effect of thezero is no longer significant. Problem 6 – Nise Problem 2.52 a) 45015 −=++ xxx &&& b) xxxx 25015 =++ &&& or 04815 =++ xxx &&& c) 45015 =++ xxx &&&

Step Response

Time (sec)

Am

plitu

de

0 1 2 3 4 5 60

0.5

1

1.5

tau=1/z=2tau=1/z=1tau=1/z=0.5tau=1/z=0.2tau=1/z=0.1tau=1/z=0.01tau=1/z=0.001