## Description

## Part 1

The dynamics of a mass-spring damper system, with applied force u(t) are modelled by

mlx¨(t) + dx˙(t) + kx(t) = bu(t), (1)

where ml

is the mass, d is the system damping, k is the spring constant and b is a proportionality constant for the input force.

1. The position is measured. Find the Laplace transform of the map from input u to x

in equation (1) with zero initial conditions. Verify that the transfer function from the

input u(s) to x(s) is of the form

η

s

2 + 2ξωns + ω2

n

. (2)

What are η, ξ and ωn in terms of the system parameters?

2. Generate a Bode plot of the transfer function described in equation (2) using the parameters in Table 1.

ml 0.52 kg

k 142 N/m

d 2 Ns/m

b k

Table 1: Parameter Values for cart-spring system

Use the Bode plot to fill in Table 2. (The Matlab commands ‘tf’ and ‘Bode’ will be

helpful in generating the Bode plot and determining the values of the gain and phase at

each given frequency. Type ‘help tf’ and ‘help bode’ for more information. Also, when

creating Bode plots, the ‘grid on’ option is a useful feature to have.)

Include as part of your report the m-file that generates the transfer function and the

Bode plot.

1

Table 2: Gain and phase of second-order system using transfer function

ω gain (dB) phase (degrees)

5

10

20

80

ωn

3. Change the natural frequency ωn to 30 and also 5 /s. Keep the other parameters the

same. Plot the frequency response of the three systems on the same plot. (The MATLAB

command ‘hold on’ maybe helpful for achieving this, or you can plot 3 Bode plots at

once. Be sure to include a legend clearly indicating which Bode plots corresponds to

which values of ωn.)

4. Explain how the natural frequency, ωn, can be estimated from the frequency response.

2

## Part 2

Figure 1: Lab apparatus

The system involves 2 carts, a load cart and a motorized cart, connected through a spring.

(See Figure 1.) In the figure z is the position of the motorized cart and x is the position of

the load cart. The force on the load cart is applied indirectly by a motorized cart as shown

in Figure 1. The load cart dynamics are modelled here by

mlx¨(t) + dx˙(t) + k(x(t) − z(t)) = 0.

which is the same as equation (1), except with z(t) instead of u(t).

1. Recall from Lab 1 that the motor cart with no spring attached can be modelled by

mmz¨(t) + νz˙(t) = αVm(t) + βz˙(t) (3)

where Vm(t) is the voltage applied to the motor. The values of the parameters are shown

in Table 3.

The addition of the spring and load cart alters the force on the cart. The motion of the

motorized cart is modelled by

mmz¨(t) + νz˙(t) + k(z(t) − x(t)) = αVm(t) + βz˙(t). (4)

2. Write the system in state-space form with states

x(t) z(t) ˙x(t) ˙z(t)

. Is the system

controllable with the voltage as control?

3. Let ˆz(s), ˆx(s) and Vˆm(s) indicate the Laplace transforms of z(t), x(t) and Vm(t), respectively. Take Laplace transforms, with zero initial conditions, of (3) and (4).

4. What is the transfer function from ˆz to ˆx? Compare to the transfer function in part 1.

mm 0.94 kg

ν 5.4 kg/s

α 1.5167

β −6.7967

Table 3: Parameter values for motorized cart

3

5. Show that the transfer function from the motor voltage, Vˆm(s), to the motorized cart

position, ˆz(s), has the form

α(mls

2 + ds + k)

γ4s

4 + γ3s

3 + γ2s

2 + γ1s + γ0

.

What are γi

, i = 0, 1 · · · 4, in terms of the system parameters mm, ν, etc.? What are the

numerical values of γi?

6. The motor cart position z(t) will be considered as the the input to the system. To

determine the frequency response of x(t), the position z(t) needs to be a sine wave. This

part is concerned with design of a controller to accomplish this.

Construct a Simulink model of this system as follows.

(a) Use a Sine Wave as the system input (found in the Sources library).

(b) Add a Subsystem block from the Commonly Used Blocks library.

(c) Double-click on the subsystem block to open it in a new window.

Add a second

Out1 block from the Commonly Used Blocks library and delete the existing

connection between the original input and output blocks. Label one of the outputs

as ˆz(s), the motorized cart position, and the other as ˆx(s), the load cart position.

(d) You have already calculated the transfer functions from Vˆm(s) to ˆz(s) and from ˆz(s)

to ˆx(s).

Use two Transfer Fcn blocks from the Continuous library to generate

the outputs ˆz(s) and ˆx(s) from the input ˆvm(s).

(e) Close the subsystem window. Connect both the outputs of the subsystem to a scope

via a Mux block, which can be found in the Commonly Used Blocks library.

(f) Add a Saturation block directly before the subsystem. Set the upper and lower

limits to +2.5 and -2.5 respectively. This limits the control input that can be

applied.

(g) Add a To File block from the Sinks library to save the data as a “.mat” file for

easier manipulation.

(h) Add feedback to the system by splitting the “ˆz” output of the subsystem and

subtracting it from the input sine wave. This requires adding a Summation block

with two input ports (one positive and the other negative). Put a feedback Gain

block after the summation block, and before the saturation. Use K = 12 in the

feedback.

As part of your report, include screenshots of Simulink model (that is, the main system

plus the subsystem) that was created based on steps (a) to (h).

7. Using an input sine wave of amplitude 0.4 and frequency 5 rad/s, run the simulation for

10 seconds. Submit a plot of the input, z(t), and the output, x(t), positions on the same

plot.

8. Repeat the previous step with frequencies 10, 20, 80 rad/s and the natural frequency.

Create a separate plot for each frequency as for the previous step.

4

9. In this step you calculate the gain and phase of the system at various frequencies using the

plots from the previous steps. Recall that the asymptotic response to input u(t) = e

iωt

is output y(t) = G(iω)e

iω. The response to sin(ωt) is therefore Im(G(iω)e

iω). Writing

G(iω) = M(ω)e

iφ(ω)

, the asymptotic response to A sin(ωt), where A is a constant, is

AM(ω) sin(ωt + φ(ω)). The gain at a particular frequency, ω, is M(ω), which is a ratio

of the amplitude of the output to the amplitude of the input. That is, the gain is

Gain = 20 log10 M(ω) = 20 log10

amplitude of output

amplitude of input

.

The phase of the system at a particular frequency φ(ω) is the phase difference between

the input and output.

The first method to calculate gain and phase requires looking at the graphs closely by

zooming in, and then estimating the appropriate values. The second method is creating

a program in MATLAB that will give a more precise value of the gain and phase shift.

For the second method, the MATLAB code must be included as part of the solution.

Method 1 : To determine the phase difference between two sinusoids, two equivalent

points on each sinusoid need to be compared: it is convenient to consider the point

where each sinusoid is zero.

From your plot, measure the time difference ∆t between

when the input sinusoid is zero and when the output sinusoid is zero. Knowing the time

difference, and the frequency ω of the sinusoids, you can use the fact that ω =

∆θ

∆t

to

calculate the phase difference as φ = ∆θ = ω∆t, and then convert to degrees. Fill in

the various values in the correct columns of Table 4.

Method 2 (via MATLAB CODE): Create a function file in MATLAB that will

give the gain and phase for a given frequency of the sine wave. Include the MATLAB

code as part of your solution.

Table 4: Gain and phase data for simulated system

ω(rad/s) input mag. output mag. Gain(dB) ∆t Phase (rad) Phase (degrees)

5

10

20

80

ωn

10. (*) Compare the values in Table 2 with the values obtained in Table 4. Are these values

similar? Suggest reasons for any discrepancies.

5

11. Apply signals with higher frequency than the ones given in the table and discuss how

the gain and phase changes in response to high frequency input.

12. According to the results obtained in Table 4 with different frequencies for the given

system, suggest a technique to obtain the natural frequency of any unknown system.

6