Uploaded by aevans

Quantitative Engineering Analysis III Textbook- Fall 2022

advertisement
Quantitative Engineering Analysis III Compendium
Written for you by almost everyone who has ever taught QEA
Updated 11/7/2022
Contents
I
Go with the Flow: Analysis of Flow-Storage Systems
6
1 Week 1, Class 1: Earth’s energy balance
1.1 Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2 Thermal radiation and Earth’s temperature . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3 Albedo experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2 Week 1 homework: Ordinary differential equations with energy applications
2.1 Personal reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Conservation of energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Introduction to ordinary differential equations . . . . . . . . . . . . . . . . . . .
2.3.1 Finding solutions to ODEs: The guess and check method . . . . . . . . .
2.3.2 Notation for derivatives in ODEs . . . . . . . . . . . . . . . . . . . . . .
2.4 Solving separable ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.1 Thermal applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.2 Initial value problems . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.3 Note: ordinary vs. partial differential equations . . . . . . . . . . . . . .
2.5 Pre-class reading: Convective heat transfer . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7
7
7
8
10
10
10
12
12
13
13
14
15
16
16
3 Week 2, Class 1: Modeling nanofiltration with first-order ODEs
18
3.1 Homework debrief . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 First-order, linear ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2.1 Solving using an integrating factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4 Week 2, Class 2: Measuring thermal properties
21
4.1 Temperature and energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2 Measuring specific heat and heat transfer coefficient . . . . . . . . . . . . . . . . . . . . . . . 21
5 Week 2 homework: Predicting flow system behavior
5.1 Practice with first-order ODEs . . . . . . . . . . . .
5.1.1 Systems with flow and storage . . . . . . .
5.2 Analyzing experimental data . . . . . . . . . . . . .
5.2.1 Thermal modeling . . . . . . . . . . . . . .
5.2.2 Figure creation . . . . . . . . . . . . . . . .
5.2.3 Data analysis . . . . . . . . . . . . . . . . .
5.2.4 Optional reading: Curve fitting tool . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
23
23
23
24
24
25
25
25
6 Week 3, Class 1: Analyzing systems with oscillations
27
6.1 Homework debrief (about 20 min) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.2 Nonhomogeneous ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.3 Flow systems with oscillations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7 Week 3, Class 2: Oscillations in the Earth system
30
7.1 Periodic inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1
2
CONTENTS
8 Week 3 homework: Spectral analysis and numerical solutions to ODEs
8.1 Introduction to spectral analysis . . . . . . . . . . . . . . . . . . . . . . .
8.1.1 ODEs & DFT: BFFs? . . . . . . . . . . . . . . . . . . . . . . . . .
8.2 Numerical methods for solving ODEs . . . . . . . . . . . . . . . . . . . .
8.2.1 Solving ODEs numerically in MATLAB . . . . . . . . . . . . . . .
8.2.2 Optional reading (with optional exercises): Slope fields . . . . . .
.
.
.
.
.
32
32
37
38
38
38
9 Week 4, Day 1: Numerical solutions and synthesis
9.1 Homework debrief (about 20 min) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2 Applying numerical solutions to ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3 Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
41
41
42
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10 Week 4, Day 2: Deriving systems of first-order ODEs
43
10.1 A thermal system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.2 A circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
11 Week 4 homework: Solving systems of first-order ODEs
11.1 Finding solutions using eigenvalues . . . . . . . . . . . . . . . .
11.2 Modeling a house with a system of ODEs . . . . . . . . . . . . .
11.2.1 Simplifying thermal modeling with resistance networks
11.2.2 Bringing it all together . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
45
46
47
47
50
12 Mini-project: First-order systems
12.1 Option 1: Passive solar house (yes, again!) . . . . .
12.1.1 House design requirements . . . . . . . . .
12.1.2 Design choices . . . . . . . . . . . . . . . .
12.1.3 What we will give you . . . . . . . . . . . .
12.1.4 Levels of challenge . . . . . . . . . . . . . .
12.1.5 Report requirements . . . . . . . . . . . . .
12.2 Option 2: Could floatovoltaics save a lake? . . . . .
12.2.1 Report elements . . . . . . . . . . . . . . . .
12.3 Option 3: Choose your own application . . . . . . .
12.3.1 Modeling with ODEs competition . . . . . .
12.4 Option 4: Textbook on Modeling with ODEs . . . .
12.4.1 Option 4a: Textbook Reading and Problems
12.4.2 Option 4b: Modeling Projects . . . . . . . .
12.5 General report-writing tips: . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
52
52
52
52
53
54
55
55
56
56
57
57
57
57
57
II
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Shake It Up: Analysis of Oscillatory Motion
58
13 Week 7, Day 2: Free Body Diagrams and Equations of Motion
59
13.1 Free Body Diagram (FBD) In-Class Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
13.2 Review of Static Equilibrium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
13.2.1 Looking Forward (if you have extra time) . . . . . . . . . . . . . . . . . . . . . . . . 62
14 Week 7 Homework: Physics Practice Problems
14.1 Review of Forces, Torque and Free Body Diagrams
14.1.1 Torque . . . . . . . . . . . . . . . . . . . .
14.1.2 Free Body Diagrams . . . . . . . . . . . .
14.2 Statics Practice . . . . . . . . . . . . . . . . . . . .
14.3 Optional: Additional Resources and Readings . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
63
63
63
63
65
66
3
CONTENTS
15 Week 8, Class 1: Equations of Motion and Second Order ODEs
15.1 Homework and FBD Debrief . . . . . . . . . . . . . . . . . . . .
15.2 Introduction to Equations of Motion . . . . . . . . . . . . . . . .
15.3 Motion of a Spring-Mass System . . . . . . . . . . . . . . . . . .
15.3.1 Storyboarding the Mass-Spring System . . . . . . . . . .
15.3.2 Visualizing Solutions to Governing Equations . . . . . .
15.4 HOMEWORK/READING FOR NEXT CLASS (About 30 minutes)
15.4.1 Damped harmonic oscillator: qualitative behavior . . . .
15.4.2 Reading: Accelerometers and motion . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
68
68
68
69
70
73
74
75
76
16 Week 8, Class 2: Accelerometers and Gathering Motion Data
16.1 Solving 2nd-Order ODEs Mini Lecture . . . . . . . . . . . . . .
16.2 Accelerometers and Motion . . . . . . . . . . . . . . . . . . . . .
16.3 Spring-Mass Carts . . . . . . . . . . . . . . . . . . . . . . . . . .
16.4 Frequency Response and the Return of the DFT . . . . . . . . .
16.4.1 Euler’s Method . . . . . . . . . . . . . . . . . . . . . . .
16.5 Looking ahead: Intro to Nonhomogeneous Second Order ODEs
16.6 Optional Bonus: More springs! . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
77
77
77
77
78
78
79
79
17 Week 8, Homework: Solving Second-Order ODEs
17.1 Systems of first-order linear ODEs . . . . . . . . . .
17.1.1 Converting from second-order to first-order
17.1.2 Converting from first-order to second-order
17.2 Damped harmonic oscillator . . . . . . . . . . . . .
17.3 Solving second-order linear ODEs . . . . . . . . . .
17.3.1 Systems of 1st order ODEs . . . . . . . . . .
17.3.2 Another Look: Guess and Check . . . . . .
17.3.3 Complex Roots . . . . . . . . . . . . . . . .
17.3.4 Euler’s formula . . . . . . . . . . . . . . . .
17.3.5 Repeated Roots . . . . . . . . . . . . . . . .
17.3.6 Damped harmonic oscillator . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
80
80
80
80
81
82
82
82
83
84
84
85
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
18 Week 9, Class 1: Damped Oscillators, Phase Planes and Non-homogeneous 2nd Order ODEs
18.1 Mini lecture: Damping, phase planes, and non-homogeneous systems . . . . . . . . . . . . .
18.2 More damped harmonic oscillators! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.2.1 Damping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.3 Damping in real life . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18.4 Nonhomogeneous Second-Order ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
86
86
87
88
89
19 Week 9, Class 2: Nonhomogeneous ODEs
91
19.1 Forced harmonic Oscillators - Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
19.1.1 Nonhomogeneous Oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
19.1.2 Forced Oscillation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
20 Week 9 Homework
20.1 Fun: Dampers in Real Life . . . . . . . .
20.2 Phase planes . . . . . . . . . . . . . . . .
20.2.1 A Deeper Look . . . . . . . . . .
20.2.2 Case 1: distinct, real eigenvalues
20.2.3 Case 2: complex eigenvalues . . .
20.2.4 Case 3: one repeated eigenvalue .
20.3 Nonhomogeneous Second Order ODEs .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
94
94
94
95
95
96
99
100
4
CONTENTS
21 Optional Extension Chapter: Pendulums - Second-Order ODEs and Rotating Reference
Frames
102
21.1 Rotating Oscillatory Systems: The Pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
21.1.1 Pendulum Reference Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
21.1.2 Rotating Frame for the Pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
21.1.3 Relationship Between Fixed and Rotating Frames . . . . . . . . . . . . . . . . . . . . 104
21.2 Rotating Reference Frames: Mathematical Background . . . . . . . . . . . . . . . . . . . . . 104
21.3 Equation of Motion with Rotating Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
21.4 Review: the Transport Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
21.5 Pendulum Revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
21.6 Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
21.6.1 Linear approximation to a function of a single variable . . . . . . . . . . . . . . . . . 107
21.6.2 All the world’s a spring... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
21.7 Solution to Linearized Pendulum Governing ODE . . . . . . . . . . . . . . . . . . . . . . . . 109
21.8 The Damped Pendulum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
21.9 Pendulum Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
22 Week 10, Class 1: Return of Spectral Analysis and the Fourier Transform
22.1 Lecture: Complex numbers [15 min] . . . . . . . . . . . . . . . . . . . . . .
22.2 HW review [15-20 min] . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.3 Review of Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . .
22.4 Introduction to the DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22.5 Review of Bases and Projections . . . . . . . . . . . . . . . . . . . . . . . .
22.6 Complex Exponentials as a Basis . . . . . . . . . . . . . . . . . . . . . . . .
22.7 Optional reading: Sampling a Continuous Time Signal . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
112
112
112
112
115
115
117
119
23 Week 10, Class 2: Computing the Discrete Fourier Transform
121
23.1 DFT lecture [40 min] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
23.2 Projection onto a Basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
24 Week 10 Homework: Behavior of the Discrete Fourier Transform
24.1 Exploring Properties of the DFT . . . . . . . . . . . . . . . . . . . . . . .
24.2 Frequencies and Periodicity of the Fourier Transform . . . . . . . . . . .
24.2.1 Aliasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24.3 Read before next class: Inverse DFT . . . . . . . . . . . . . . . . . . . . .
24.4 Optional enrichment reading: The Fourier transform is complex valued!
24.5 Appendix A (optional reading): Orthogonality of Complex Exponentials
24.6 Appendix B (optional reading): Determining Shifted Frequency Values .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
125
126
127
130
131
132
133
134
25 Week 11, Class 1: Filtering
25.1 HW review [20-30 min] . . . . . . . . . . . . . . . . . . . . . . . .
25.2 Introduction to Filtering . . . . . . . . . . . . . . . . . . . . . . .
25.2.1 Filtering in the Frequency Domain . . . . . . . . . . . . .
25.2.2 Limitations of Frequency Domain Filters . . . . . . . . . .
25.3 Optional, but highly recommended section: Time Domain Filters .
25.4 Optional but Recommended: Filtering Experimental Data . . . . .
25.5 OPTIONAL: Linear, Time-Invariant Systems . . . . . . . . . . . .
25.5.1 What we really want you to know about LTI systems . . .
25.5.2 Precise definition of LTI systems . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
135
135
135
136
137
138
140
140
141
141
26 Week 11: [No] Homework
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
143
5
CONTENTS
27 Week 11, Class 2: Systems of 2nd-order ODEs
27.1 Revisiting Spring-Mass Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.2 Mechanical System Frequency Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27.3 Eigenmodes of a Coupled Mass System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
144
144
145
145
28 Week 12, Class 1: Bringing it all together in the last day before break!
148
28.1 Mini Lecture: Overview of the two mass spring system . . . . . . . . . . . . . . . . . . . . . 148
28.2 Getting Real . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
28.3 Systems of Second Order ODEs - Analyzing Data . . . . . . . . . . . . . . . . . . . . . . . . 149
28.3.1 Experimental Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
28.3.2 Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
28.4 Synthesis: Putting it all Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
28.5 Additional Explanations and Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
28.6 Towards a Final Project - 20 min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
28.6.1 Optional Exercise and Resources for Measuring and Interpreting Motion (i.e. “Fitbit") 152
29 Final Project Description
29.1 Creating Value by Analyzing Motion . .
29.1.1 Overview . . . . . . . . . . . . .
29.1.2 Project Requirements . . . . . . .
29.1.3 Proof-of-Concept . . . . . . . . .
29.1.4 (Some) Project Options . . . . . .
29.1.5 Deliverables . . . . . . . . . . . .
29.1.6 Timeline . . . . . . . . . . . . . .
29.1.7 Resources . . . . . . . . . . . . .
29.2 Developing Insight by Analyzing Motion
29.3 ODE Textbook Study . . . . . . . . . . .
29.4 The Synchronisation of Clocks . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
155
155
155
156
157
157
157
159
159
160
160
161
Part I
Go with the Flow: Analysis of
Flow-Storage Systems
6
Chapter 1
Week 1, Class 1: Earth’s energy balance
Learning Objectives
This week:
• Analyze conservation of energy in familiar thermal systems
• Recognize ordinary differential equations (ODEs)
• Solve separable ODEs
1.1
Welcome
Welcome back to QEA!
This first five-week module introduces ordinary differential equations (ODEs) and thermal modeling in
the context of climate change and sustainable housing. It will culminate in a project to design a passive solar
tiny house for our local climate.
Teaming tip: As you work through exercises in your group today, make sure everyone is on the same
page before moving on to the next question. Also, think about the role you are playing in your group. Are
you usually holding the whiteboard marker? Are you usually listening quietly? Try to notice where your
comfort zone is today—then next time, perhaps you can push yourself to step out of it.
Exercise 1.1
Using the closest whiteboard, please sketch a diagram of your table with folks’ names and pronouns
to help the teaching team.
1.2
Thermal radiation and Earth’s temperature
Why is the Earth so cozy? This problem aims to get you thinking about systems involving flows of energy—
and get some energy flowing through the mathematical parts of your brains!
Thermal radiation encompasses the range of electromagnetic waves emitted due to an object’s temperature. The amount of thermal radiation an object emits depends on the surface temperature T (in K) and
surface area A (in m2 ) of the body according to the Stefan-Boltzmann law,
Q̇emit = ϵσAs T 4 ,
7
(1.1)
8
CHAPTER 1. WEEK 1, CLASS 1: EARTH’S ENERGY BALANCE
where Q̇emit is the emitted radiation heat transfer rate (in Watts, W), ϵ is the emissivity (the fraction
of the maximum possible radiation that is emitted), and σ is the Stefan-Boltzmann constant (5.67 ×
10−8 W m−2 K−4 ).
At your tables, calculate the answer to the following questions. We recommend working symbolically
until it comes time to calculate something, and then filling in values with units. Here are some values to
get you started:
Property
Distance from Sun to Earth
Diameter of Earth
Diameter of Sun
Temperature of Sun
Symbol
RSE
DE
DS
TS
Value
1.496E11
1.274E7
1.391E9
5778
Units
m
m
m
K
Exercise 1.2
1. How much radiation is emitted by the sun? (in W) You can assume the sun’s emissivity is 1.
2. The sun’s rays spread out in a sphere and don’t really lose any power before reaching Earth.
Given Earth’s size and its distance from the sun, estimate the magnitude of solar power (in W)
that reaches the Earth. (Note: We suggest you sketch the situation. We are trying to get you
used to thinking about energy, geometry, estimations, and math after a long summer, so take
your time here. See if you can enjoy the feeling of stretching those critical thinking muscles.)
3. If all of the solar radiation reaching the Earth was absorbed, and the maximum amount was
re-emitted (see Eq. 1.1 with ϵ = 1) what would the equilibrium (i.e., heat in = heat out)
temperature of the Earth be?
4. What would be the Earth’s temperature in the more realistic case where only 70% of the
radiation is absorbed? (The maximum amount of radiation is still re-emitted (ϵ = 1) because
the Earth, like most things, radiates close to the maximum amount in the low-temperature
wavelengths.)
5. How do these predictions compare to the actual average temperature of Earth, which is about
288 K (15 ◦ C)?
6. This simplified model of the Earth’s climate didn’t consider the atmosphere. Qualitatively,
how do you think the presence of the atmosphere affects the temperature of the Earth?
1.3
Albedo experiment
This experiment invites you to sense the effect of surface color on solar heat absorption.
The actual amount of radiation absorbed by the Earth depends on Earth’s albedo, meaning the fraction of
incoming radiation that is reflected. Shiny, white glaciers contribute to Earth’s albedo, reflecting incoming
solar energy and keeping Earth cool and creating a feedback loop for climate change. Let’s see how surface
lightness affects the temperature of an object placed in the sun.
CHAPTER 1. WEEK 1, CLASS 1: EARTH’S ENERGY BALANCE
9
Figure 1.1: Example thermometer/paper setup for albedo lab.
Grab a small piece of white paper and color half of one side of it black. Fold the paper over the tip of a
probe thermometer so that the black and white halves are each on one side of the tip and secure it somehow
(e.g., with tape or a rubber band). Ideally, both halves of the paper will be in good contact with the tip of the
thermometer; you can squeeze the paper a bit with your fingers. An example of this setup is shown in Fig.
1.1.
Bring this setup near a sunny spot (indoors or outdoors) (or, if needed, at a consistent, small distance
from a light bulb instead) and measure the air temperature with the paper out of direct light. Hold the
thermometer suspended in the air with your fingers far from the tip so your skin doesn’t affect the reading.
Then expose one side of the paper to the light for a few minutes and watch the temperature change. Record
the temperature after it reaches a steady value, then flip the thermometer so the other side of the paper is
exposed to the sunlight. After the temperature has stabilized again, record the new temperature.
Exercise 1.3
1. What temperatures did the white and black patches of paper reach in the sun? How do they
compare to the air temperature? Why do they differ in this way?
2. Thinking about how this experiment relates to climate change: If rising temperatures cause
glaciers to melt, how will melting glaciers in turn affect global average temperature?
3. Glaciers and global temperature can be considered to be in a feedback loop because each affects
the other. Look up the terms "positive feedback" and "negative feedback." (One option is this
video–the first part covers it pretty well.) What do they mean? Can your group think of other
examples of negative and positive feedback loops?
4. Do glaciers provide negative or positive feedback in the Earth’s climate system? What does
this mean for climate change on Earth?
Chapter 2
Week 1 homework: Ordinary
differential equations with energy
applications
2.1
Personal reflection
Exercise 2.1
• Take a few minutes to look forward at this class and consider the following questions:
– What are your hopes and learning goals for QEA3?
– What, if anything, are you concerned about?
– What learning strategy or strategies would you like to try in this class? (E.g., starting
homework in office hours, practicing asking questions, listening actively...)
– Please introduce yourself and share some of your answers with the teaching team via this
survey. If you would rather answer anonymously, you can submit your name/pronouns
and responses separately. You do not have to answer all questions.
2.2
Conservation of energy
Analyzing the flow, storage, and conversion of energy allows us to predict the behavior of many systems.
There are many ways of writing the equations for conservation of energy. A rather limited version that will
serve us well in this module is the equation for energy conservation in a closed system (one which does
not have mass flowing in and out) with fixed boundaries (i.e., not growing, shrinking, or moving), no
energy conversion (from chemical reactions, etc.), and no work transfers (such as from a motor shaft or
electrical wire):
dU
= Q̇net = Q̇in − Q̇out ,
dt
(2.1)
where U is the internal energy of the system, t is time, Q̇net is the net rate of heat transfer into the system,
Q̇in is the rate of heat transfer into the system, and Q̇out is the rate of heat transfer out of the system.
Essentially, this is a system where energy only transfers in and out in the form of heat.
10
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS11
We saw an example of such a system in 1.2 when we considered the solar radiation absorbed by the Earth,
the thermal radiation emitted from the Earth to space, and the temperature the Earth reached at equilibrium
(i.e., when the energy storage term dU
dt was equal to zero).
When energy accumulates in a closed system, its temperature increases. How much its temperature
increases is related to the system’s heat capacity. For example, you may have noticed that a larger plate of
food takes more time to heat in the microwave; a larger plate of food has a greater heat capacity, so it will
take more energy to heat it up to a given temperature, and thus will take longer at a given microwave power.
The definition of heat capacity (often denoted C) is the amount of energy required to raise the temperature
of an object or system by a unit temperature (e.g., 1 Kelvin). Since this must depend on the mass of the
object, we often work with the specific heat capacity (often denoted as c) instead. This is a material property
defined as the heat capacity per unit mass, e.g., in metric units, the amount of energy in Joules (J) required
to raise 1 kg of a material by 1 Kelvin. For a uniform object (like a block of metal), these parameters are
related by c = C/m, where m is the object’s mass. For a (relatively incompressible) substance like liquid
water, the constitutive relation between energy and temperature can be stated as:
U = mcT
(2.2)
We will often be considering the rate of change of thermal energy, dU/dt. If the mass of an object is fixed,
and its specific heat capacity doesn’t change, then the rate of change of thermal energy is proportional to
the rate of change of temperature,
dU
dT
= mc .
(2.3)
dt
dt
Exercise 2.2
How much does a minute in the microwave heat up a cup of water? Let’s consider water that has
mass m (neglecting the weight of the cup) and specific heat c. If we consider a simple model in which
we assume all of the microwave’s output power Q̇ gets absorbed by the water, no heat is lost from
the water, and the water does not boil, how will the water temperature change over time while it’s
being heated in the microwave?
1. Using the equations for conservation of energy and the constitutive relation for the energy
of a pure substance, write an equation for dT
dt as a function of microwave power Q̇, water
mass m, water specific heat c, and/or time in the microwave t. Qualitatively describe how the
water’s temperature will behave over time.
2. Take a time integral of both sides, assuming the water starts at room temperature (T0 ), to find
an equation for the temperature as a function of time in the microwave.
3. Emily microwaved 1 cup (about 240 grams) of water in a mug for 1 minute in a 1000 Watt
microwave and its temperature rose from 25 ◦ C to 63 ◦ C. Use this data (making approximations
as needed) to estimate the specific heat of water. If you wish, you can also try this experiment
yourself.
Hint: be careful with units when plugging values into your equation. You may need to convert
between minutes and seconds, etc., to end up with a specific heat in the metric units of J/kg-K
(or, equivalently, J/kg-◦ C; temperature differences in Celsius and Kelvin are equal).
4. Look up the specific heat of liquid water at room temperature. Calculate a percent error to
quantify how the specific heat estimated from experimental data compares to the published
value. Explain any discrepancy. What would you change to make this experiment more
accurate?
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS12
2.3
Introduction to ordinary differential equations
The equation you derived for the heating of a cup of water in a microwave in the last exercise ( dT
dt =...) is an
example of an ordinary differential equation. It’s actually one of the simplest types of ordinary differential
equations because the right-hand-side was a constant and we could simply integrate to find a solution. In
this class, we will learn how to derive and solve many types of ordinary differential equations to predict the
time-dependent behavior of a variety of systems.
When you encounter new terms and definitions in this section, don’t worry too much about memorizing
them—you can always refer back to this section later—and instead, just try to understand what they mean.
The following is an example of an ordinary differential equation (ODE),1
y ′′ (x) + 5y ′ (x) + 6y(x) = 0.
(2.4)
In general, an ODE is any equation (meaning it needs an equals sign) that involves a function and some of
its derivatives. And a solution to an ordinary differential equation is any function which makes the
differential equation true. For example,
y(x) = 9e−2x − 7e−3x
is a solution to the above differential equation (Eq. (2.4)).
When you’re reading a differential equations textbook, the problems will say something like “solve the
differential equation y ′ (x) = 0.” You should interpret that as meaning “find a function or class of functions
y(x) such that y ′ (x) = 0.”
Exercise 2.3
Verify (by hand) that
is a solution to the ODE,
y(x) = 9e−2x − 7e−3x
y ′′ (x) + 5y ′ (x) + 6y(x) = 0.
(2.5)
In other words, take the first and second derivatives of y(x), then substitute them into the ODE and
verify that it’s true.
Exercise 2.4
Find one or more solutions to the ODE y (x) = 0. For what function (or class of functions) y(x) is
y ′ (x) = 0 true?
′
2.3.1
Finding solutions to ODEs: The guess and check method
Differential equations have a strong analogy with many people’s least favorite part of high school algebra:
finding the roots of a polynomial. For a general polynomial, there’s no simple procedure to find the roots.
(There are some special cases that are easier; with second degree polynomials, you can use the quadratic
formula.) However, if you have a guess for a root of a polynomial, it is easy to check whether it is correct by
simply plugging your answer into the equation. You might not know how to find all the values of x that
satisfy the equation,
x5 + 3x3 + 3x2 − 5x − 2 = 0,
but you might guess that x = 1 works, substitute that value into the equation, and verify your answer.
A similar story holds true in the world of differential equations. Given an arbitrary differential equation,
there is no procedure that will always produce the exact answer. Some procedures work in special cases
1 The
apostrophe denotes a derivative. If this notation is unfamiliar, please see Section 2.3.2, "A note on notation."
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS13
(one of which we’ll learn about in the next section). If you have a guess for a solution, then you can always
substitute it in and try. This also makes it easier to check your work.
Exercise 2.5
For each of the following ODEs, guess a solution and then verify that your solution is correct. If a
guess doesn’t come to mind, you may want to try integrating or considering exponential and trig
functions.
Ex. y ′ (x) = 2 (solution: y(x) = 2x)
1. y ′ (x) = x
2. y ′ (x) = y(x)
3. y ′′ (x) = −y(x)
2.3.2
Notation for derivatives in ODEs
Calculus (and especially differential equations) lacks a standard notation. This problem dates way back to
the invention of calculus. Our first differential equation (2.4) is written, using Lagrange’s notation,
y ′′ (x) + 5y ′ (x) + 6y(x) = 0,
which we can abbreviate as,
y ′′ + 5y ′ + 6y = 0,
when the input variable x is clear. Alternatively, we can write the same differential equation using Leibniz’s
notation:
d2 y
dy
+5
+ 6y = 0.
2
dx
dx
This can be helpful for solving with separation of variables, a strategy we’ll learn shortly.
In physics, it’s common to denote the time derivative using Newton’s notation: the first derivative is ẏ,
the second derivative is ÿ, and so on, e.g.:
ÿ + 5ẏ + 6y = 0.
The dot notation is used almost exclusively for the time derivative, so we know implicitly that the solution
to the ODE above is function of time y(t).
Throughout this course, you will see all of these styles of notation.
2.4
Solving separable ODEs
The first family of differential equations for which we can find an exact solution are separable ODEs. A
separable ODE can be written in the form
F (x) dx = G(y) dy
(2.6)
for some functions F and G. Less formally, this means that you can manipulate the ODE so that all the xs
are on one side and all the ys are the on the other side. Writing the ODE in this form allows us to solve
it by simply integrating. Here’s a step-by-step example:
1. Let’s say we want to solve the ODE y ′ = −6xy.
2. Switch to Leibniz notation,
dy
= −6xy.
dx
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS14
dy
3. Now we treat dx
as if it’s a fraction. (It’s actually not, but this works.) Multiply both sides of the
equation by dx and divide by y. This gives
dy
= −6x dx.
y
Now, the ODE is in the form from (2.6), where F (x) = −6x and G(y) = 1/y.
4. Integrate both sides
to get
Z
1
dy =
y
Z
−6x dx
ln(y) = −3x2 + c.
Recall that we only have to put the constant of integration on one side of the equation. (We suggest
convincing yourself of that.)
5. This gives us the general solution
2
y = ke−3x ,
where k is a new constant given by k = ec .
Notice that we demonstrated that y ′ = −6xy is separable in Step 3 by putting it in the special form (2.6).
Unfortunately, not all differential equations are separable. For example, y ′ + xy + x = 1 is not separable
because it cannot be put in the form (2.6). (Try to separate it and convince yourself.)
Exercise 2.6
A glorious fact about solving differential equations is that you can almost always check your work by
plugging your proposed solution back in to the original ODE. Check that the method in the preceding
2
example worked. In other words, verify that y(x) = 7e−3x solves the ODE by plugging y(x) and
its derivative into the differential equation.
Exercise 2.7
Using the technique outlined above for solving separable ODEs, solve the following ODE:
dy
x
= 2
dx
y
In other words, find y(x).
2.4.1
Thermal applications
So what do ODEs have to do with thermal systems? We’ll get into more applications in future assignments
when we discuss how to solve non-separable ODEs, but here’s one (separable) problem to close the loop.
Let’s consider our microwaved mug of water and think about how it might cool over time if we leave it
exposed to air. Conservation of energy U for the mug/water system dictates that
dU
= −Q̇out ,
dt
(2.7)
where Q̇out is the rate of heat loss to the room. If we assume that heat loss is by convection then the rate of
heat loss can be assumed to be proportional to the temperature difference between the mug/water and the
surrounding air,
T − Troom
(2.8)
Q̇out =
R
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS15
where R is a heat transfer constant that captures the total thermal resistance of the water/mug system. Since
the rate of heat loss has units of Joules per second, the thermal resistance must have units of Kelvin-second
per Joule. (We will compare this to electrical resistance later!)
The thermal energy U of the mug/water (compared to the room) is given by C(T − Troom ), where C is
the heat capacity of the mug/water. It will be convenient (for analysis) to define θ = T − Troom : this is a very
common symbol for temperature difference in mechanical engineering, even though we usually interpret θ
as an angle in mathematics. With these definitions, the governing equation becomes the separable ODE
dθ
θ
=−
dt
RC
(2.9)
where RC is a constant (that you might recognise from ISIM!).
Exercise 2.8
Solve the separable ODE,
dθ
θ
=−
dt
RC
for θ(t), and describe how the temperature of the water in the mug changes over time.
2.4.2
Initial value problems
If you review your solutions to the ODEs we have solved so far, you will notice that there is always a constant
in the solution. For example, we hope you found that θ = C0 e−t/RC was the solution to θ′ = −θ/RC,
where C0 is a constant. Since we can choose C0 arbitrarily, this implies that there are an infinite number of
solutions to the ODE. How do we reconcile this with the world around us which suggests that if we put
our water down to cool, and measured its temperature over time, we get a single temperature profile (not
infinitely many)?
We might say that our solutions so far are general solutions; they describe the rules of the system overall.
The equation you found in 2.8 will describe the behavior of the water in the mug no matter when we put it
out to cool or how hot it is initially. However, to find our specific temperature profile, we need to give our
general equation more information and solve for our constant using some known initial conditions. This
is a bit like finding the y-intercept back in algebra; y = 2x + b has infinite solutions, but if we know that
y = 4 when x = 0, we can find the line we’re looking for.
To keep calculations simple and easy, it is very common practice to declare t = 0 to be the moment we
set down the mug to cool, as if you are starting a stopwatch at that exact moment. We need to know the
temperature of the water (compared to the room) when we set it down, but to keep it general we will define
θ0 to be the temperature at t = 0, i.e. θ(0) = θ0 .
Now that we have the initial temperature we can solve the initial value problem, which consists of an
ODE and an initial value. We already found that the general solution to the ODE is
θ(t) = C2 e−t/RC
If we evaluate at t = 0 we see that
θ(0) = C2
i.e. the constant is dictated by the initial value. According to our definition this implies that C2 = θ0 , and
the solution to the initial value problem is therefore
θ(t) = θ0 e−t/RC
Notice that the initial temperature θ0 has an effect on the solution, but it simply scales the exponential. You
can also check to see if your answer makes sense by plugging in some numbers for t that are easy to check.
You already used θ(0) = θ0 ; what happens when t approaches infinity? Does the behavior make sense?
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS16
Note: Although we use the term initial value problem, you don’t actually need the initial value to find
your solution; any point will do. If you forgot to measure the temperature when you started your stopwatch,
you could plug in temperature T at t = 5 min instead and theoretically get the same results. We often choose
initial values because 1) it makes the math easier and 2) these are often the easiest to determine or measure.
2.4.3
Note: ordinary vs. partial differential equations
Throughout this course, we’ll almost exclusively be dealing with ODEs, which means that the solution to
the differential equation is a function of one variable. For example,
dy
+ 3y = 0
dx
is an ODE because the solution y(x) is a function of one variable, x.
In contrast, the solution of a partial differential equation (PDE) is a function of more than one variable.
For example,
∂u
∂2u
=α 2
∂t
∂x
is a PDE, since the solution u(t, x) is a function of two variables, t and x (α is a constant). (This particular
PDE is called the heat equation.) Notice that the differential equation involves the partial derivative of u
with respect to t and the partial derivative of u with respect to x.
While we won’t solve PDEs in this course, note that separation of variables can be used to solve some
PDEs.
2.5
Pre-class reading: Convective heat transfer
Thermal convection is the transfer of heat from a surface by a moving fluid. We experience thermal
convection all the time because we live in air (and occasionally other fluids); you have definitely noticed
convection if you’ve ever felt cold outdoors in the wind or enjoyed the feeling of a fan on a hot day.2
A convective heat transfer coefficient quantifies how easily heat is transferred from a surface to a
fluid. The heat transfer coefficient h is typically defined as:
h=
Q̇
,
A∆T
(2.10)
where Q̇ is the heat transfer rate, A is the surface area, and ∆T is the temperature difference between the
surface and the fluid. As can be seen from the metric units of Q̇/(A∆T ), heat transfer coefficients have
metric units of Watts per square meter per Kelvin (usually written W/m2 -K).
Convective heat transfer coefficients h depend on:
• The fluid in contact with a surface
• The speed of the fluid
• More subtly, how the fluid flows over the surface
When the fluid has a higher thermal conductivity, density, and specific heat, heat transfer coefficients
are higher. Water is higher in all those parameters than air, so heat transfer coefficients tend to be higher in
water than in air. When the fluid flows faster, heat transfer coefficients are higher. That’s where “wind chill”
comes from.
Absent forced fluid flow (e.g. from a fan, pump, etc), differences in temperature result in “natural
convection:" Hot or cold surfaces will heat or cool the fluid around them; warm fluid with higher energy
particles will have a lower density than cool fluid, creating density gradients. Under the influence of gravity,
2 To
improve course accessibility and the studio experience, we have tried to avoid assigning long readings during class. We hope
that this reading will help prepare you to predict the behavior of a variety of thermal systems, including an experimental setup you will
test next week.
CHAPTER 2. WEEK 1 HOMEWORK: ORDINARY DIFFERENTIAL EQUATIONS WITH ENERGY APPLICATIONS17
warmer fluid will rise, cool fluid will fall, and all this movement will raise the heat transfer coefficient. Due
to the role of gravity, orientation determines the effect on heat transfer coefficients: when heat transfer from
a surface causes a pocket of warm fluid below a pocket of cool fluid, the system is unstable and will flow;
conversely, warm fluid above cool fluid tends to be stable.
If you can estimate the heat transfer coefficient between a surface and the surrounding fluid (from
experiments, experience, or the use of a published correlation, of which there are many), you can estimate
the rate of heat loss or gain from the object that has that surface.
As an example, consider standing outside when the temperature is 0 ◦ C. Assume your uncovered skin
(perhaps hands and face, with a total area of 0.1 m2 ) has a temperature of 32 ◦ C. If there is no wind, the
heat transfer coefficient from your skin to the air might be about 15 W/m2 -K. We can estimate the rate of
heat loss (in W) from your exposed skin to the air by rearranging Eq. 2.10 to show that the convective heat
transfer rate is:
Q̇ = hA∆T = 15 W/m2 -K · 0.1 m2 · (32 ◦ C − 0 ◦ C) = 48 W
(2.11)
48 W is comparable to the power consumption of a laptop. In reality, your body may not expend that
much heat just in your hands and face, so your skin will probably get colder. (Does that sound familiar?)
We’ll continue to consider convective heat transfer throughout this module. Convection is a powerful
mode of energy transfer. Without convection, we wouldn’t have a water cycle. Ponder that!
Exercise 2.9
This problem aims to help you check your understanding of how to estimate convective heat transfer
rates using known heat transfer coefficients.
Consider the example from the reading (standing outside when the temperature is 0 ◦ C; assume your
uncovered skin (hands and face, with a total area of 0.1 m2 ) has a temperature of 32 ◦ C), but now it’s
pretty windy—windy enough that the heat transfer coefficient has doubled to 30 W/m2 -K. Estimate
the rate of heat loss (in W) from your exposed skin to the wind. How does this compare to your
experience on windy winter days?
Chapter 3
Week 2, Class 1: Modeling
nanofiltration with first-order ODEs
Learning Objectives
This week:
• Notice analogies between thermal and electrical energy systems
• Derive ODEs to describe a range of systems involving flow
• Solve first-order, linear ODEs using the integrating factor formula
• Synthesize understanding of energy and ODEs through extracting thermal properties from
experimental data
3.1
Homework debrief
Exercise 3.1
(Time goal: 15 min)
With your table, go through the solutions to the homework due today and identify a list of key
concepts. Identify which of these concepts you feel comfortable with and which are still confusing.
Try to resolve your confusions (about topics or specific problems) with the folks at your table and by
talking to an instructor.
3.2
First-order, linear ODEs
Any linear, first-order ODE can be written as
y ′ + P (x)y = Q(x)
(3.1)
and any differential equation of this form has an analytic solution. But, as of now, we only know how to
solve these equations when Q(x) = 0 and we can use the method for separable ODEs to solve them. We call
these equations where Q(x) = 0 homogeneous. (Logically, when Q(x) ̸= 0, we call it nonhomogeneous.)
18
19
CHAPTER 3. WEEK 2, CLASS 1: MODELING NANOFILTRATION WITH FIRST-ORDER ODES
Exercise 3.2
Use the fact that
y ′ + P (x)y = 0
is a separable differential equation to show that the general solution is y(x) = e−
3.2.1
R
P (x) dx
.
Solving using an integrating factor
Let’s generalize the solution to Exercise 3.2 to see how to solve any equation of the form (3.1), i.e., any linear,
first-order differential equation.
The general solution to a linear, first-order differential equation
y ′ + P (x)y = Q(x)
is
R
y(x) =
µ(x)Q(x) dx + C
µ(x)
where
µ(x) = e
R
P (x) dx
(3.2)
(3.3)
and C is a constant. We call µ(x) the integrating factor.
Exercise 3.3
Show (by hand), using (3.2), that the general solution to xy ′ − 3y = x3 is y(x) = x3 (ln x + C).
Then find (by hand) a particular solution corresponding to the initial condition y(1) = 10.
Next, let’s try a more applied example. Systems involving flows and storage of fluids and dissolved
or suspended materials are common in water management and treatment, chemical production, and food
processing applications.
For example, many food crops are sensitive to low levels of salt in the soil, so it can be difficult to reuse
agricultural drainage water directly, even when water scarcity makes reuse desirable. However, nanofiltration
(which filters out the majority of salt from water) could be used to reduce the salinity of agricultural drainage
water for reuse.
Let’s model a semi-batch process, in which drainage water enters the nanofiltration system constantly
while cleaner product water is produced, but the concentrated waste stream is only released intermittently.
Such a system could enable a large fraction of the drainage water to be reused. The following problem asks
you to apply what you have learned about first-order, linear ODEs to modeling the performance of a realistic
system.
Exercise 3.4
A semi-batch nanofiltration system has a constant volume V , and is initially (at time t = 0) filled
with drainage water at concentration sd (as mass of salt per volume of water). Drainage water enters
the system at a volume flow rate R.a The nanofiltration membrane retains 95% of the salt, so product
water leaves the system at ϕ = 0.05 times the current salinity in the systemb with the same volume
flow rate R. You can assume the liquid in the system is well-mixed and that the salinity is low enough
that the density is constant.
When nine times the system volume have passed through the system, the plan is to discard the final
water remaining inside the system, thus recovering 9/10 of the drainage water for reuse.c
1. At the end of the process (te = 9V /R, before discarding anything), what will be the salinity of
CHAPTER 3. WEEK 2, CLASS 1: MODELING NANOFILTRATION WITH FIRST-ORDER ODES
20
the water in the system? (Seeking symbolic answer.)
2. What will be the salinity of the water being produced at the very end (as a numerical fraction
of the drainage water’s salinity)?
3. Do you have any ideas to improve this process?
Suggested steps (with moderate scaffolding):
• Draw a simple diagram of the flows of water and salt in and out of the nanofiltration system.
Quantify these flows using the given variables.
• Write an ODE for the salt mass in the system as a function of time and put it into the form
y ′ + P (x)y = Q(x).
• Solve the ODE with an appropriate initial condition. Check with your intuition.
• Answer the questions above.
a Hint:
this brings salt into the system at a mass flow rate sd R.
salinity is equal to the salt mass in the system divided by the system volume.
c The system could then be refilled and the cycle could then be repeated.
b Hint:
There are many systems with flows and storage, leading to a plethora of applications of first-order, linear
ODEs in engineering and life. As another example, heat transfer rates are often proportional to temperature
differences (i.e., hotter things give off more heat). Internal energy is also proportional to temperature, so
rates of change of temperature tend to have some linear relationship with the temperatures in a system. This
leads to a lot of first-order, linear ODEs in thermal systems.
Chapter 4
Week 2, Class 2: Measuring thermal
properties
4.1
Temperature and energy
In this chapter, we will use conservation of energy concepts and ODEs to experimentally measure two
properties that affect the thermal behavior of systems: specific heat and convective heat transfer coefficient.
Heat capacity and the material property specific heat affect how long it takes a thermal system to change
temperature. For example, you may have noticed that a larger plate of food takes more time to heat in the
microwave; a larger plate of food has a greater heat capacity, so it will take longer to heat up to an optimally
delicious temperature at a given microwave power.
The metric definition of heat capacity (often denoted C) is the amount of energy required to raise the
temperature of an object by 1 ◦ C. Specific heat, a material property (often denoted c), is defined in the metric
system as the amount of energy required to raise 1 kg of a material by 1 ◦ C. For a uniform object (like a
block of metal), these parameters are related by c = C/m, where m is the object’s mass.
Exercise 4.1
This problem reviews important relationships for measuring heat capacity experimentally.
1. What equation describes the relationship between rate of change in temperature, heat capacity,
and rate of change of energy?
2. What is the equation for convective heat transfer rate as a function of surface and fluid
temperatures?
4.2
Measuring specific heat and heat transfer coefficient
By analyzing the temperature of a slab of material over time as it is heated, we will calculate that material’s
specific heat while simultaneously determining the convective heat transfer coefficient (described previously)
of the air in our classroom on a still, flat surface. Although you will measure the heat transfer coefficient
on a horizontal rectangle of some particular material, the measured value will provide a good estimate of
convective heat transfer coefficients on many non-moving surfaces in indoor air, such as your skin when
sitting still or the inner walls of a house.
With your table group, choose a material and find its mass using a scale; mass is helpful to know because it
relates specific heat to heat capacity. Grab a thermal measurement setup for your table and attach everything
as described in today’s Canvas assignment. Then we invite you to create a layered structure as depicted
21
CHAPTER 4. WEEK 2, CLASS 2: MEASURING THERMAL PROPERTIES
22
below using tape and/or rubber bands. The styrofoam insulates the back of the heater so that almost all heat
flows into the slab.
A tiny blob of thermal paste will help conduct heat from the material of interest to the thermistor bulb so
that the measured temperature is close to that of the material, rather than close to that of the air. The other
thermistor should be held or propped up so that it measures the temperature of the air in the room. The
styrofoam insulation is meant to prevent heat loss from the back of the heater and direct as much heat as
possible into the material whose heat capacity you are measuring.
Depending on your chosen material, the small (5-Watt) heater may take some time to raise the temperature
of the slab. Feel free to ask questions of the teaching team if you are unsure about how to set up the experiment.
Exercise 4.2
Record and save data for temperature vs. time for the slab during heating. Also note the air temperature, the mass of the slab, and what you think the slab material is. Include this info and a link to the
data in your submission.
Once the experiment is running satisfactorily, we recommend discussing with your team what kind
of thermal model will allow you to extract a heat capacity value from the slab-heating data. Modeling
and analysis will be completed as part of the homework.
Chapter 5
Week 2 homework: Predicting flow
system behavior
5.1
Practice with first-order ODEs
Exercise 5.1
Find the general solution to y ′ + py = q, where p and q are constants. This general solution will
apply to any linear, first-order ODE with constant coefficients.
5.1.1
Systems with flow and storage
Electrical circuits can also often be described by first-order, linear ODEs (or linear systems of first-order,
linear ODEs). In ISIM you met RC circuits, and if you need a refresher on these, you may review the following
material from ISIM on resistors and capacitors, and think through the questions below.
Exercise 5.2
1. Consider a resistor with some voltage difference across it and some current passing through it.
By what equation are current, voltage, and resistance related?
2. Consider a capacitor with some voltage difference across it and some current passing through
it. By what equation are current, voltage, and capacitance related?
3. How do you add electrical resistors in series? In parallel?
4. What are Kirchhoff’s laws?
Try out your understanding by completing the following exercise.
Exercise 5.3
Consider the following RC circuit. Assume that all initial voltages are 0, and that at some point in
time the input voltage is set to a constant Vin .
23
CHAPTER 5. WEEK 2 HOMEWORK: PREDICTING FLOW SYSTEM BEHAVIOR
24
1. Determine the governing ODE for the output voltage Vout using the relationships identified in
the previous exercise.
2. What will the output voltage be in the long run? I.e., what is the equilibrium Vout ?
3. Find the analytic solution to the ODE for Vout (t).
4. About how long will the circuit take to approach steady state? Express your answer in terms
of the system parameters. We’re looking for a symbolic estimate of the order of magnitude.
5.2
5.2.1
Analyzing experimental data
Thermal modeling
You have analyzed several systems involving flows and storage, and you have predicted their behavior over
time using linear first-order ODEs. These techniques will help you interpret your experimental slab-heating
data and estimate the specific heat of the slab.
Exercise 5.4
Construct a thermal model for your measurement device to interpret its behavior.
1. Draw a diagram (any way that makes sense to you) representing flows and storage of energy
in the experimental system. Where and how does energy enter or leave the system? Where is
energy stored? (Note: it is helpful to clearly define a system with a boundary in your diagram.)
2. Define a set of reasonable assumptions to guide your model (e.g., the temperature of the
material is uniform; the room air temperature remains constant...).
3. Write an ODE for the temperature of the material of interest over time, given an unknown
convective heat transfer coefficient h, an unknown specific heat c, a heater power Q̇, a material
mass m, and a material surface area exposed to air A. (No need to solve it yet.)
4. Using your ODE, write an expression for the expected initial rate of change of temperature if
we assume the initial temperature of the material is that of air. How does the initial rate of
change relate to heat transfer coefficient and/or specific heat?
5. Using your ODE, write an expression for the steady-state (or equilibrium) temperature of the
device (i.e., the temperature at very long times when the time derivative of temperature is
zero). How does the steady-state temperature relate to heat transfer coefficient and/or specific
heat?
CHAPTER 5. WEEK 2 HOMEWORK: PREDICTING FLOW SYSTEM BEHAVIOR
25
6. Solve your ODE symbolically for the expected temperature of the material over time. Hint:
have you solved a similar equation before?
5.2.2
Figure creation
Hopefully you have collected some data showing your material’s temperature rising and ultimately leveling
off. In MATLAB, while focusing on the temperature plot, press ’p’ to send the data collected so far to a .mat
file while continuing to collect data. You will use this data to estimate the heat capacity. If you don’t have
data yet, you may ask another group for data for the purpose of creating a figure in class.
We invite you to practice an important skill in technical communication: making a clear figure with
labeled axes, units, etc., and without unnecessary clutter.
Exercise 5.5
Make a nice plot of the temperature vs. time data you have collected, as if you were going to use
the plot in a report. The figure should not have a title (i.e., a figure name above the figure). Instead,
write a descriptive caption that would go beneath the figure in a paper or lab report. Submit the plot
with the caption below it.
5.2.3
Data analysis
There are multiple ways to extract the parameters of interest from the data, just one of which is to use
curve fitting; if you wish to go that route, you are welcome to read the optional section on curve fitting in
MATLAB, which follows this section.
Exercise 5.6
1. Use the data you collected to estimate your chosen material’s specific heat. Explain, using
equations, figures, and words (as needed), how you extracted a specific heat from the data.
2. Look up the specific heat for your material (or a similar material, if you can’t find the exact
same one) in a textbook or online. List the value and the source. What was the measurement
error? What might have contributed to measurement error?
3. Use the data you collected to estimate the heat transfer coefficient between the air in the room
and a non-moving surface. Explain, using equations, figures, and words (as needed), how you
extracted a specific heat from the data.
4. Typical heat transfer coefficients in indoor air tend to be around 5 to 20 W/m2 -K. Was your
measurement within or near that range? If not, why not?
5.2.4
Optional reading: Curve fitting tool
You may wish to do curve fitting to compare your ODE solution to the data you collected in class to measure
the heat capacity of materials. You can use MATLAB’s cftool to obtain parameters to fit your predicted
equation to your data.
cftool is an approach to curve fitting based on optimization. If you think back to last semester, you met
the concept of optimization in a number of contexts. You learned how to frame the problem of computing a
line of best fit using the concept of least squares. cftool uses essentially the same approach, except instead
26
CHAPTER 5. WEEK 2 HOMEWORK: PREDICTING FLOW SYSTEM BEHAVIOR
of requiring your model to be linear (which was required for some of the tools you learned last semester),
cftool lets you fit any arbitrary non-linear function.
In preparation for using cftool, assign your x values for your curve (times) into a variable (e.g., » time
= data(:,1);) and assign your y values for your curve (temperatures) into a variable (e.g., » T =
data(:,2);). To launch cftool type » cftool at the MATLAB command prompt. This will bring up
the curve fitting tool. Once cftool is open, you’ll want to perform the following steps.
1. Set the X data field to the variable that you assigned your time values to (e.g., time). Set the Y data
field to the variable that you assigned your temperature values to (e.g., T).
2. Select Custom Equation from drop down list at the top middle of the window (it can be difficult to find
this setting. By default, it will probably have a value of “Interpolant”).
3. Enter the equation that you would like to fit to your data. As long as the Auto fit box is checked,
MATLAB should automatically fit the curve to your data. If you have problems fitting your data, you
can mess around with the Fit options dialog. Setting reasonable initial values for your parameters can
help with convergence. If you are not getting reasonable results, re-examine your equation and make
sure it has the right form and that you have all the necessary parameters.
The plot below provides an example of how the fit might look:
45
Temperature (°C)
40
Experimental data
Curve fit
35
30
25
0
500
1000
1500
2000
2500
3000
3500
Time (s)
Figure 5.1: Example curve fit of experimental heating data
4000
Chapter 6
Week 3, Class 1: Analyzing systems
with oscillations
Learning Objectives
This week:
• Find periodic solutions to ODEs
• Use the Discrete Fourier Transform as a tool to understand the frequency content of signals
• Solve ODEs numerically
6.1
Homework debrief (about 20 min)
Exercise 6.1
With your table, go through the solutions to the homework due today and identify a list of key
concepts. Identify which of these concepts you feel comfortable with and which are still confusing.
Try to resolve your confusions (about topics or specific problems) with the folks at your table and by
talking to an instructor.
6.2
Nonhomogeneous ODEs
In analyzing the experimental setup in class, you derived a nonhomogeneous ODE of the form,
dy
+ py = q
dt
whose solution is
y = Ce−pt +
q
p
Notice that the solution consists of two pieces. The first term (with the general constant C) is the solution to
the homogeneous ODE (in which we set q = 0). The second term is the solution to the non-homogeneous
problem. This is no accident, as the following observation suggests.
27
28
CHAPTER 6. WEEK 3, CLASS 1: ANALYZING SYSTEMS WITH OSCILLATIONS
Exercise 6.2
Consider the following ODE,
dy
+ py = 0 + q0 + q1
dt
Show that the solution can be written as the following sum,
y = yh + y0 + y1
where each part of the solution satisfies the following ODEs
dyh
+ pyh
dt
dy0
+ py0
dt
dy1
+ py1
dt
=
0
(6.1)
= q0
(6.2)
= q1
(6.3)
This shows that a first-order linear ODE with multiple inputs can be solved sequentially, i.e., by
summing the solutions for each individual input.
6.3
Flow systems with oscillations
It’s common for both natural and engineered systems to have oscillating flows into the system, which can
lead to oscillatory behavior. ODEs can help us understand the effects of these oscillations, as is another tool
we’ll encounter shortly and explore throughout this course: the Fourier Transform.
Many sensors produce a current output ranging from 4-20 mA, which corresponds to the full range of
whatever the sensor is measuring (e.g., pressure from 0-15 psi). This output is typically read by allowing that
current to flow through a resistor and measuring the voltage difference across it. Sometimes there are slight
oscillations in the current that we might wish to filter out by placing a capacitor in parallel with the resistor,
as we’ll explore in the next problem.
Exercise 6.3
A current source to the circuit below takes the form I(t) = A + B sin(ωt), where A and B are
constants.
CHAPTER 6. WEEK 3, CLASS 1: ANALYZING SYSTEMS WITH OSCILLATIONS
1. In the absence of a capacitor, what would Vmeas (t) be?
2. Use Kirchhoff’s Laws and the Ohm’s law for capacitors to derive an ODE for Vmeas (t).
3. We wish to determine the long-term performance of this filter, and we aren’t as worried about
the initial, short-term behavior, so we can seek out a solution that is periodic. Solve the ODE for
a periodic solution of the form Vmeas (t) = D + E sin(ωt) + F cos(ωt) (i.e., find the constants
D, E, and F ). One method would be plugging Vmeas (with its unknown constants) and its
derivative into the ODE to solve for the constants.
4. How effective would this filter be if RC ≫ (1/ω)? Please be as quantitative as possible in the
time that you have.
If you have any extra time in class, we invite you to try predicting the circuit’s overall behavior (not
just the long-time, periodic solution) using the integration factor formula.
29
Chapter 7
Week 3, Class 2: Oscillations in the
Earth system
Exercise 7.1
With your table, take a few minutes to generate a list of natural oscillations on Earth. (One example
might be water level at a certain location due to tides.) Estimate the main period(s) of oscillation for
each one.
Exercise 7.2
1. Here is almost a year of hourly water level data (in m) for the tide in the Boston harbor.
Estimate the amplitude and frequency (or frequencies, in Hz) of tidal oscillation. Include units.
2. Throughout this class, we will become acquainted with a mathematical tool called the Fourier
Transform. The Fourier Transform extracts the amplitude of different frequencies embedded
in a signal, similar to the way you extracted the amplitude of different eigenfaces from a photo
in QEA2. It is helpful in analyzing data where multiple oscillations at different frequencies
are present. The script make_freq_plot.m takes in a string of data x and a sampling frequency
(how many times per second the data was recorded) Fs and outputs a plot of the amplitude
of the different frequencies present. For the tidal data collected hourly, what is the sampling
frequency in Hz?
3. Plot the frequency content of the tide data using make_freq_plot.m. What do each of the
spikes on the frequency plot mean? Compare the frequency plot with your initial estimation.
7.1
Periodic inputs
We’ve largely worked with first-order, linear ODEs, but aside from the current source filter, we’ve mostly
analyzed cases where P and Q are constants. Many fluctuating systems with flow and storage—including
natural systems such as tides, which have a range of oscillations due to planetary motion—belong to a case
where Q is a periodic function, which we will now consider in general terms.
30
CHAPTER 7. WEEK 3, CLASS 2: OSCILLATIONS IN THE EARTH SYSTEM
31
Exercise 7.3
Consider the ODE,
dy
+ py = A sin(ωt)
dt
Use the integrating factor approach to find the solution. You will probably want to use a computer
algebra system to do one of the integrals.
It is worth taking a minute to examine the solution to the previous problem. The right-hand side of the
ODE has led to a component of the solution that has both a sine and a cosine. Looking at the sine term we
can re-write it as
A sin(ωt)
p 1 + ωp22
Consider: When is the sine term of the input damped in the output?
Exercise 7.4
Consider again the heating pad used in last week’s experiment, but now the heating pad is fluctuating
in time. Let’s assume for now that the fluctuations are periodic of the form Q̇ = Q̇avg + B sin(ωt),
where Q̇avg is the average power of the heater, B is the amplitude of the oscillations, and ω is the
frequency of the oscillations.
1. Incorporate this fluctuating heater power into the model - it should still be first-order linear.
2. Find the general solution to the first-order linear ODE. This can be accomplished using the
usual integrating factor technique. Alternatively, can you use ODE solutions you have already
derived?
3. Describe each part of the solution, thinking carefully about how the oscillating heater power
affects the solution.
Chapter 8
Week 3 homework: Spectral analysis
and numerical solutions to ODEs
8.1
Introduction to spectral analysis
Systems with flow and storage, whether natural or engineered, often have oscillatory behavior when exposed
to a periodic input. Additionally, we will soon begin to explore mechanical systems and second-order
differential equations, which often have oscillations even without periodic inputs. In any of these cases,
it can be helpful to visualize signals as a function of frequency, especially when multiple frequencies are
present in the signal, as you saw with the tides. This process, which is referred to as spectral analysis or
frequency analysis, involves transforming a signal from the time domain to the frequency domain.
We’ll dive into the math of frequency analysis soon, but for now, we shall try to get an intuitive
understanding of the frequency content of signals. Here, we will make use of a pair of MATLAB functions:
make_time_plot.m and the previously-provided make_freq_plot.m to plot time or frequency data for a given
signal and sampling frequency. The sampling frequency or “sampling rate” is the rate at which a continuous
signal is recorded as discrete data points (e.g., if you recorded the temperature every 0.1 seconds, the sampling
rate would be 10 per second or 10 Hz).
Exercise 8.1
Load the file noise.mat, which contains two samples of a noise signal, x1 and x2, sampled at a rate of
fs. Play the two samples using sound(x1, fs) and similarly for x2. You will have to wait for one
to finish playing before starting to play the next. Without actually plotting the frequency content of
these signals, please determine which of the following frequency plots in Figure 8.1 corresponds to
which signal, and make sure you can explain why.
[Audio description: x1 is a deep/low sound; x2 sounds like white noise/static and includes high and
low sounds.]
32
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
Figure 8.1: Frequency domain plots corresponding to the two samples in the file noise.mat
Exercise 8.2
Download the following .mat file which contains a recording of Beethoven’s tuning fork (from the
British Library: https://soundcloud.com/the-british-library/beethovens-tuning-fork). [No listening
component.]
1. Plot the time domain waveform using make_time_plot(x, fs);
2. Zoom in on the latter part of the waveform and try to figure out what frequency the tuning
fork is at.
3. Repeat the steps above, but now make a frequency-domain plot of the signal using
make_freq_plot(x, fs).
4. Determine what frequency the tuning fork is for by appropriately zooming into the graph.
Please ignore the negative frequencies for now. We will get back to this later.
Exercise 8.3
In the previous example, the signal really only had one frequency, and so it was quite easy
to determine the frequency content of the signal using the time domain plot. Figuring out
the frequency content of more complex signals is more challenging. Load the following file
with the recording of a flute from the Music Technology Group, University of Pompeau Fabra
(http://freesound.org/people/MTG/sounds/361080/). [No listening component.]
1. Download the file and plot the time domain waveform using make_time_plot(x, fs);.
Identify the major frequencies present in the signal.
2. Make a frequency-domain plot of the signal using make_freq_plot(x, fs).
3. Zoom in to figure out the frequency content in the flute note. You will see three prominent
frequencies in the flute recording. The lowest frequency of the three tells you what note it
is, and the remaining two (which are at multiples of the lowest frequency) contribute to the
quality or timbre of the note.
33
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
34
If you hit a key on a piano, it produces a wave as the air molecules vibrate. If you hit a different key, it
produces a different wave. If you hit both keys at the same time, the wave that it will produce is a combination
of the two individual waves. Combining waves is easy—you simply add them together.
For example, the red function in Figure 8.2 below is the combination of the sine waves 4 sin(2πt) and
sin(2π · 3t), shown in blue and green, respectively. The formula for the red function is just 4 sin(2πt) +
sin(2π · 3t).
But how do you take waves apart? In other words, if I gave you just the red curve, how could
you determine the two basic sine waves which comprise it?
Figure 8.2: The red function is simply the combination of the functions shown in blue and green.
This is where the Fourier transform comes in handy. From one perspective (of which there are many),
the Fourier transform is a tool to help you take apart waves.
Figure 8.3 below shows a graph of 4 sin(2πt) and the absolute value of its Fourier transform. Similarly,
Figure 8.4 below shows a graph of sin(2π · 3t) and the absolute value of its Fourier transform.
Figure 8.3: Left: Time domain plot of 4 sin(2πt). Right: Absolute value of its Fourier transform
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
Figure 8.4: Left: Time domain plot of sin(2π · 3t). Right: Absolute value of its Fourier transform
Exercise 8.4
Let’s make some observations.
1. What’s the frequency of 4 sin(2πt)? And what’s the frequency of sin(2π · 3t)?
2. How are these frequencies represented in the frequency domain? (I.e., how could you find the
frequency from a plot of the function in the frequency domain?)
3. What’s the amplitude of 4 sin(2πt)? And what’s the amplitude of sin(2π · 3t)?
4. How are these amplitudes represented in the frequency domain?
Exercise 8.5
Figure 8.5 shows the absolute value of the Fourier transform of some sine function.
Figure 8.5: Fourier transform of a mystery sine wave.
What is the specific formula for the sine wave (you can assume it is a sine with a phase shift of 0)
that would get by taking the inverse Fourier transform?
35
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
36
Now, let’s look at the absolute value of the Fourier transform of the sum of the two waves (left), shown
in the right pane of Figure 8.6. It is the sum of two Fourier transforms.
Figure 8.6: Left: The red curve shown in Figure 8.2. It is the sum of two waves. Right: Absolute value of the
Fourier transform of the curve.
Exercise 8.6
Recall our original question: if I gave you just the red curve, how could you determine the two basic
sine waves which comprise it? Try to write down a procedure for recovering the blue and green
curves, given the red curve.
Using this procedure, the Fourier transform breaks down a complicated wave into simple waves, fundamental building blocks. The picture in Figure 8.7 below shows a more slightly complicated example. (Click
here to see an animated version of this on the Fourier transform Wikipedia article.)
Figure 8.7: Breaking down an approximation of a square wave into constituent sine waves of increasing
frequency.
Let’s say you want to better understand the complicated red wave in Figure 8.7, which approximates a
square wave, then you should take its Fourier transform and plot the absolute value, which is the graph with
blue bars shown on the right. Each of those blue bars corresponds to the light blue sine wave adjacent to it.
The x-position of the blue bar indicates the frequency of the adjacent wave—notice that the wave becomes
higher frequency as you move to the right—and the height of the blue bar indicates the amplitude of the
adjacent wave.
This description of the Fourier transform can help us use it as a tool, but it’s oversimplified. In the
future, we will dive into the mathematics of the Fourier transform. If you wish to start learning about
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
37
the mathematics now, here is a resource with a concise mathematical description of the discrete Fourier
transform and extended notes on its properties and applications.
8.1.1
ODEs & DFT: BFFs?
How might ODEs and the DFT, together, help us analyze a system? One possibility is that ODEs could help
us predict system behavior and then the DFT could help us translate behavior into an understanding of
system performance.
You learned some rules for designing RC filters in ISIM. In the following challenge problem, you will
do some of the math behind those rules, predict the behavior of a filter with an ODE, and quantify its
performance using the DFT.
Exercise 8.7
Let’s consider again the RC filter shown below, which we wish to use to reduce noise while converting
a sensor’s current output to a voltage. Now we wish to design this filter to reduce the amplitude
of high-frequency noise while still transmitting a desired low-frequency, sinusoidal signal. We can
predict the effectiveness of the filter by comparing the frequency content of the output voltage with
and without a capacitor, and we can use the prediction to choose the best capacitor value.
Let’s say the current output from the sensor to the filter contains sinusoids of two frequencies:
I(t) = A + Bd sin(ωd t) + Bn sin(ωn t), where A is the average current (a constant), Bd is the
amplitude of the desired signal, Bn is the amplitude of the noise, ωd is the angular frequency of the
desired signal, ωn is the angular frequency of the noise, and ωn ≫ ωd .
1. Write an ODE for Vmeas (t). Because only the current input has changed, you can base this
ODE on your previous model of this circuit.
2. Analytically find a solution for Vmeas (t) assuming an initial condition of Vmeas (0) = AR.
We suggest you utilize methods of solving nonhomogeneous ODEs and general solutions for
nonhomogeneous ODEs with periodic inputs identified throughout this assignment.
3. Given numerical values A = 0.012 A (non-italic A meaning amps), Bd = 0.003 A, Bn = 0.004 A
(yes, more noise than desired signal), ωd = 4π rad/s, ωn = 120π rad/s, a resistor value of R =
250 ohms, and C = 5 × 10−14 F to represent just the resistor’s parasitic capacitance, plot the
measured voltage in the case without a capacitor for a duration of 2 s with 2000 points. Then,
choose a new, higher capacitance value C that you think will effectively filter out noise at
frequency wn without having much effect on the magnitude of the desired signal at frequency
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
38
wd . Plot both filtered and unfiltered voltages on the same plot, and feel free to adjust your
chosen capacitance until you are satisfied with the filter’s performance.
4. Use make_freq_plot.m to plot the magnitude of the different frequencies within Vmeas , both
with your chosen capacitor and without a capacitor (C = 0). You may need to zoom in to
clearly show the changes. Based on the magnitudes of the different frequency components,
comment on the effectiveness of this filter in reducing noise while preserving the desired
signal.
Please check that your plots will be readable by ensuring they have axis labels with units and, if
applicable, legends.
8.2
Numerical methods for solving ODEs
Many models we might like to use to describe real systems are not amenable to analytical solutions. Or
sometimes, even when an analytical solution exists, a numerical solution that can be found quickly is
adequate. You have seen Euler’s method in ModSim. Here, we’ll introduce two more methods of numerically
solving ODEs in this homework for your toolkit. We’ll apply the MATLAB’s ode45 tool next week. The slope
fields section is optional, but has been included as well, as a helpful way to visualize ODEs.
8.2.1
Solving ODEs numerically in MATLAB
Open the documentation for ode45 in MATLAB and read the example called "ODE with a single solution
component."
Exercise 8.8
Just to make sure you get the syntax, try solving y ′ = 2t using ode45 and plotting the solution.
Check that the output matches the example in the documentation.
8.2.2 Optional reading (with optional exercises): Slope fields
Sometimes, it’s helpful to create a slope field, which is essentially a pictorial representation of an ODE. The
video in the next exercise describes what exactly this means. (Word of caution, if you look through other
resources: slope fields are sometimes called direction fields.)
Figure 8.8: Slope fields for P ′ (t) = rP (t) with r = 0.5 (left) and r = −0.1 (right).
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
39
Exercise 8.9
Watch this Khan Academy video on creating a slope field.
1. Draw (by hand) a slope field for y ′ = x. Just draw enough to get a feel for what the slope field
looks like.
2. On top of the slope field, graph the analytical solution to y ′ = x.
3. What do you observe about the connection between the slope field and a solution to the ODE?
The slope field can tell us (approximately) what the solutions to the ODE are. Watch this other Khan
Academy video to get a sense of why. A solution to the ODE will always follow (i.e., be tangent to) the
slope field. This is because the ODE is literally prescribing the slope, or direction, of the solution function.
[Editorializing: It may take a while to really understand why ODE solutions are tangent to slope fields. It
will probably help if you watch the video and then pause, reflect on why this is true, and try to explain it to
your neighbor/friend/hamster.]
Exercise 8.10
This is the slope field for y = y + x with two solutions displayed. Use the slope field to identify a
solution to the ODE which is a straight line. What’s the equation of this line?
′
Figure 8.9: Slope Field
Exercise 8.11
Copy the following lines into a blank document in Mathematica and evaluate them (ctrl+return) to
make a slope field corresponding to the differential equation y ′ + py = q:
Manipulate[VectorPlot[{1,-p*y+q},{x,0,3},{y,0,10},
VectorStyle->Arrowheads[0]],
{p,1,3,Appearance -> "Labeled"},
{q,1,6,Appearance -> "Labeled"}]
It should produce a slope field of y ′ + py = q, where p and q are constants. You can use the sliders
to vary p ∈ [1, 3] and q ∈ [1, 6].
1. Set the sliders all the way to the left to fix p = q = 1. What do you notice about the slope
field? Draw a few qualitatively different solutions to the differential equation.
2. Now, set the sliders all the way to right to fix p = 3 and q = 6. What do you notice about the
slope field? Draw a few qualitatively differential solutions to the differential equation.
3. Continue to experiment. What are the roles of p and q in the differential equation y ′ + py = q?
CHAPTER 8. WEEK 3 HOMEWORK: SPECTRAL ANALYSIS AND NUMERICAL SOLUTIONS TO ODES
40
4. Next, copy the following into Mathematica:
Manipulate[
Plot[q/p+(Subscript[y,0]-q/p)*E^(-p*x),{x,0,10},
PlotRange->{{0,10},{0,10}}],
{p,1,3,Appearance -> "Labeled"},
{q,1,6,Appearance -> "Labeled"},
{Subscript[y,0],0,10,Appearance -> "Labeled"}]
This should produce solutions to y ′ + py = q for different values of p and q and for different initial conditions y(0) = y0 . How do these solutions align with your predictions and
interpretations from parts 1 through 3?
Slope fields are powerful because they are a representation of the general solution—they show us many
different initial conditions. For example, by looking at the slope field in Figure 8.10 for y ′ = sin(x − y),
we can see that there are straight-line solutions (e.g., the red and green lines) and solutions which curve
in between (e.g., the blue curve). Notice that the blue curve approaches the straight-line solutions as x
becomes large (to the right) and as x becomes small (to the left). Slope fields also give us information about
the long-term behavior of solutions.
Figure 8.10: Slope field for y ′ = sin(x − y)
Slope fields also give us a graphical way of approximating a solution for any ODE, even when an analytical
solution or computational tool is not available, because you can calculate a grid of local slopes and just draw
a solution by following along the lines. Slope fields would be a good way to solve ODEs in an apocalypse.
Chapter 9
Week 4, Day 1: Numerical solutions
and synthesis
Learning Objectives
This week:
• Synthesize understanding of modeling systems with flows and storage
• Create thermal resistance networks
• Analyze thermal systems using systems of equations
• Solve systems of first-order ODEs
9.1
Homework debrief (about 20 min)
Exercise 9.1
With your table, go through the solutions to the homework due today and identify a list of key
concepts. Identify which of these concepts you feel comfortable with and which are still confusing.
Try to resolve your confusions (about topics or specific problems) with the folks at your table and by
talking to an instructor.
9.2
Applying numerical solutions to ODEs
Many climate models with different levels of complexity and fidelity exist. Even some of the simplest models
can give us some degree of insight into the thermal behavior of the Earth.
The ice-albedo feedback loop discussed in Chapter 1 makes small ice caps unstable. Herald et al. (2013)1
simplified a partial differential equation (PDE) model from North (1984)2 of Earth’s ice-albedo feedback loop
into the following ODE:
x′ = −0.003 + (1 − x) ∗ (Q − 335 + 3((x − 0.89)/0.09)2 ),
(9.1)
1 Herald, C.M., Kurita, S. and Telyakovskiy, A.S. (2013), Simple Climate Models to Illustrate How Bifurcations Can Alter Equilibria
and Stability. Journal of Contemporary Water Research & Education, 152: 14-21.
2 North, G. R., 1984: The Small Ice Cap Instability in Diffusive Climate Models. Journal of Atmospheric Science., 41, 3390–3395.
41
CHAPTER 9. WEEK 4, DAY 1: NUMERICAL SOLUTIONS AND SYNTHESIS
42
where x is the sine of the latitude of glacier extent (x → 1 is the glaciers disappearing) and Q is the surfacearea-averaged solar radiation flux on Earth (1/4 of the solar constant). Note: the units of time derivative
x′ are per century. In being simplified from the original PDE model to demonstrate the instability of small
glaciers, the above equation lost some accuracy, so you might consider it to be a model for some Earth-like
planet. It also does not incorporate changes in the atmosphere such as we are currently experiencing. This
nonlinear ODE can be solved numerically to probe the effect of ice-albedo feedback on the climate of a planet
such as Earth and practice using ode45.
Exercise 9.2
1. Looking at the Equation 9.1 and using with Q = 334, at what glacier extents x would Earth’s
ice caps be in equilibrium? (Hint: What is the derivative of x at equilibrium?) We’re just
looking for numerical values, so solve for them however you like.
2. Using Eq. 9.1 and MATLAB’s ode45 with Q = 334, solve for the glacier extent parameter x as
a function of time (in centuries–you might try a range of 0 to 2) for a range of initial glacier
extent values x0 (let’s say 0.8 to 1 and several values in between). Given that x = sin(ϕ),
where ϕ is the glacier edge latitude, plot the glacier latitude as a function of time for the
same range of initial glacier extents. Explain in words what you see in the plot. What ice cap
sizes represent stable equilibria according to this simple model? Which, if any, equilibria are
unstable?
3. What can this model tell us about climate change? Due to its limitations, what does it not tell
us?
9.3
Synthesis
We’ve been talking a lot about modeling systems with flow and storage and predicting their behavior by
solving ODEs. As we approach a project where you will apply these skills to a new system, now would be a
good time to take a step back and consider how everything you have been learning comes together.
Exercise 9.3
1. With your group, please create a concept map of everything we’ve covered in QEA3 so far,
including math topics, physics topics, ODE applications, etc. Include your group’s concept
map with your submission.
2. Create a recipe for modeling a system with flows and storage. What are some key questions,
assumptions, and strategies to consider? Try to come up with a recipe that would have been
helpful in scenarios you have encountered and you will be able to follow when confronted
with new and challenging modeling scenarios. Create a concise visual representation of the
recipe (such as a flowchart) that you would want to refer to when analyzing a new type of
system.
3. Based on the concept map and recipe, identity which concepts and skills you are comfortable
with, and which you are still uncomfortable with or unsure about. If you have time, work
with your group to try to resolve uncertainty and ask an instructor/CA if you need help. For
this part, please submit a brief note on which concepts you would like more practice with
and how you intend to get that practice (e.g., office hours, apply in a project, find an external
resource...).
Chapter 10
Week 4, Day 2: Deriving systems of
first-order ODEs
Let’s allow ourselves to consider a system with linked subsystems. To begin, we will ask you to set up the
differential equations describing a system. Then we will learn to solve such a system. You can choose which
problem to do first, and it’s okay if you don’t finish both.
10.1
A thermal system
Exercise 10.1
Given crowding in the dorms, you decide to build a very tiny house in Parcel B to live in this winter.
It is a cube 2 × 2 × 2 m in size and made of 1 cm-thick wood. To keep the house warm at night,
you plan to warm up 150 kg of bricks in front of one of Olin’s exhaust vents and pile these bricks
nightly in the middle of your tiny house.
We have previously discussed how there are parallels between electrical resistance and thermal
resistance (e.g., the convective resistance 1/(hA)). Heat transfer between parts of this system can be
described by thermal resistances, a concept which we will dig deeper into later in this chapter. In
this problem,
Tb − Tw
Q̇bricks→walls =
,
R1
where Tb is the brick temperature, Tw is the wall temperature, and R1 is the thermal resistance
between the bricks and the walls;
Q̇walls→air =
Tw − Tout
,
R2
where Tout is the external air temperature and R2 is the thermal resistance between the walls and
the external air.
1. To set up your equations, we suggest you simplify the problem. The bricks, air inside the house,
and wood all have some heat capacity and will store some energy, but some heat capacities
may be much greater than others. Using properties given in the table below, estimate the heat
capacity (in J K−1 ) of each part of the house (bricks, air, and wood). Which of these are most
significant? Look at the ratios between heat capacities, and decide which heat capacity could
reasonably be neglected (“neglected” meaning intentionally assumed to be zero for modeling
purposes).
43
CHAPTER 10. WEEK 4, DAY 2: DERIVING SYSTEMS OF FIRST-ORDER ODES
Material
Brick
Air
Wood
Density (kg m−3 )
2000
1.2
700
44
Specific heat (J kg−1 K−1 )
800
1000
1700
2. With the aid of a sketch showing thermal interactions, write down the governing ODE for
the temperature of the pile of hot bricks after you bring them into your house. (Note: the
as-yet-unknown temperature of the wooden wall of the house should make an appearance in
this equation.)
3. You can write a similar governing equation for the temperature of the wall. Make sure to take
into account all the heat flows that affect the temperature of the interior of the house! (Note:
the temperature of the pile of bricks should make an appearance in this equation.)
4. Comment on the efficacy of bringing in warm bricks to keep the home warm. Can you think
of a better material or strategy?
10.2
A circuit
Exercise 10.2
Consider the RC circuit in the figure. Assume that all initial voltages are 0, and that at some point in
time the input voltage is set to a constant Vin .
1. Determine the governing ODEs for the middle voltage Vmid and the output voltage Vout . You
do not need to solve the equations at this point.
2. Your ODEs should look very similar to the equations for the tiny house problem above.
According to the equations, what plays the role of the resistors and capacitors in the tiny
house? (If you did the circuit first, you can come back to this question after you’ve considered
the tiny house.)
You have now derived systems of ODEs for two different applications. We will learn how to solve systems
of first-order ODEs in this week’s homework.
Chapter 11
Week 4 homework: Solving systems of
first-order ODEs
We saw earlier in this assignment that systems with multiple energy storage elements cannot necessarily be
described by a single first-order ODE. In this assignment, we’re going to continue building our differential
equations toolkit by learning to identify and solve coupled systems of first-order ODEs.
Let’s think about a system of two coupled, linear, homogeneous, first-order ordinary differential equations
with constant coefficients. That means we’ll have two differential equations of the form
y1′ (t) = a11 y1 (t) + a12 y2 (t)
y2′ (t) = a21 y1 (t) + a22 y2 (t)
where a11 , a12 , a21 , a22 are real numbers. Notice that both ODEs are linear, homogeneous, and first-order.
We say that y1 (t) and y2 (t) are coupled because they depend on each other and can’t be solved independently.
It ends up being very useful to view the system of differential equations as a matrix product,
′ y1 (t)
a11 a12 y1 (t)
=
.
y2′ (t)
a21 a22 y2 (t)
In order to find the solutions to the system of coupled ODEs, we will study the entries in the 2 × 2 matrix.
Exercise 11.1
We need to start with a little linear algebra review. It’s particularly important to have a visual
understanding of eigenvalues and eigenvectors. If you want to brush up on some of these concepts,
watch this 3Blue1Brown video.
1 3
1. Compute the eigenvalues and eigenvectors of A =
.
4 5
2. The matrix A has two linearly independent eigenvectors, which we’ll call v1 and v2 . These
form a basis for R2 , i.e., we can write any other vector w as a linear combination of v1 and v2 ,
i.e, w = c1 v1 + c2 v2 . Write the following three vectors as linear combinations of v1 and v2 ,
w1 =
1
0
−1
, w2 =
w3 =
0
1
−2
3. Draw w3 . Then draw Aw3 without actually doing the matrix-vector multiplication.
4. Draw w1 . Then draw Aw1 without actually doing the matrix-vector multiplication.
45
46
CHAPTER 11. WEEK 4 HOMEWORK: SOLVING SYSTEMS OF FIRST-ORDER ODES
11.1
Finding solutions using eigenvalues
From this matrix perspective, we will discover that eigenvalues are the key to finding solutions. Specifically,
if we have a system of first-order differential equations
y1′ (t) = a11 y1 (t) + a12 y2 (t)
where a11 , a12 , a21 , a22
matrix product,
y2′ (t) = a21 y1 (t) + a22 y2 (t)
y (t)
a
are real numbers, let y = 1
and A = 11
y2 (t)
a21
a12
, so we can write it as a
a22
y′ (t) = Ay(t).
Let λ1 and λ2 be the eigenvalues of A the coefficient matrix, and let v1 and v2 be the corresponding
eigenvectors with entries
v
v
v1 = 11 v2 = 12 .
v21
v22
For now, let’s assume that λ1 and λ2 are both real, and λ1 ̸= λ2 . As you noticed on the previous
assignments, the exponential function has a special relationship with ODEs. Let’s guess that
y(t) = eλ1 t v1
is a solution to the ODEs. To find y′ (t), we take the derivative of each component,
y′ (t) =
d λ1 t
(e v1 ) = λ1 (eλ1 t v1 ).
dt
(11.1)
Using the fact that v1 is an eigenvector with eigenvalue λ1 , we have,
Ay(t) = A(eλ1 t v1 ) = λ1 eλ1 t v1 .
(11.2)
Therefore, combining (11.1) and (11.2), y′ (t) = Ay(t). In order words, y(t) = eλ1 t v1 is a solution!
Since the previous calculation is true for both eigenvalues, this gives us two solutions
y(t) = eλ1 t v1
and
y(t) = eλ2 t v2 .
To find the general solution, we take any linear combination of these two solutions. So, the general form is
y(t) = C1 eλ1 t v1 + C2 eλ2 t v2 .
If you know initial conditions, you can then solve for the constants C1 and C2 to get the particular
solution.
CAUTION: If λ1 = λ2 , i.e., there is a repeated eigenvalue, then it is possible that there is only one linearly
independent eigenvector, so the above method fails. And if the eigenvalues are complex, the situation also
gets more... complex. We’ll deal with these situations later.
Exercise 11.2
Using the method outlined above, solve (by hand) the following problems. If you’d like to see a fully
worked out example, watch this video.
1. Find the general solution to y ′ (t) = 4y + 2z and z ′ (t) = 3y − z.
2. Find the particular solution to y ′ (t) = z(t) and z ′ (t) = y(t) − 2z(t) with initial conditions
CHAPTER 11. WEEK 4 HOMEWORK: SOLVING SYSTEMS OF FIRST-ORDER ODES
47
y(0) = 0 and z(0) = −1.
We now know that the solution to a linear system of ODEs
dy
= Ay
dt
where A is a constant matrix is given by
y(t) = c1 eλ1 t v1 + c2 eλ2 t v2 + . . .
as long as the eigenvalues λi are distinct. Notice that by using the matrix formulation we could be discussing
a large system of ODEs - it simply doesn’t matter since a matrix of size N × N will have N eigenvalues.
This form holds even if the eigenvalues are complex.
11.2
Modeling a house with a system of ODEs
Most thermal systems have multiple components at different temperatures and multiple paths for heat flow.
These systems could certainly be described using a large number of ODEs, but the number of ODEs can
be reduced to the number of elements where energy is being stored. As you may have noticed, thermal
resistances behave like resistors in a circuit (where the current is heat flow and the voltages are temperatures),
so the number of ODEs required to model a thermal system can be reduced by modeling heat flow with
thermal resistance networks.
11.2.1
Simplifying thermal modeling with resistance networks
As we have seen, it is possible to draw an analogy between the flow of heat and the flow of electricity. Because
both heat and electrical power flow in linear proportion to a relevant potential difference (temperature and
voltage, respectively), both can be modeled using resistance networks. Thermal resistance networks can help
group several heat flows through different materials into a single parameter (an overall resistance), which
can greatly simplify modeling of thermal systems. Like many skills and tools in QEA, thermal resistance
networks are a way to describe a real system with a simple model that enables prediction and analysis of
possible designs.
You may remember from ISIM that complicated resistance networks can be analyzed in terms of resistances in series or parallel. When electricity has to flow through one resistor and then another, those
resisters are in series. When electricity can flow through one resistor or another to get to the same place in
the circuit, those resistors are in parallel.
For resistors Ri in series, the total resistance is:
X
Rseries =
Ri
(11.3)
i
For resistors Ri in parallel, the total resistance is:
Rparallel =
X
(Ri )−1
−1
(11.4)
i
Generally, when heat flows through a system from one element (a solid, fluid, or surface with fairly
uniform temperature) to another, the rate of heat transfer is related to the thermal resistance as follows:
Q̇ =
Thot − Tcold
Rtot
(11.5)
The total thermal resistance depends on the materials and geometry involved and whether the heat flows
through materials in series and/or in parallel. Much like electricity, when heat flows through one material
48
CHAPTER 11. WEEK 4 HOMEWORK: SOLVING SYSTEMS OF FIRST-ORDER ODES
and then another, those thermal resistances are in series. A common thermal resistors-in-series situation is
multiple layers of different materials (such as a sweater and a jacket) that heat must pass through. When
heat can flow through one material or another to get to another material or surface, those resistors are in
parallel. Parallel thermal resistance situations may involve spatially separate paths of heat transfer (like tea
losing heat through the mug or from the top surface) and/or multiple modes of heat transfer (such as how
both convection and radiation take heat away from your exposed skin in the winter). You can still use Eqs.
11.3 and 11.4 to analyze thermal resistance networks, making use of the following equations for types of
thermal resistance:
For (relatively steady) conduction through a material with thermal conductivity k, cross-sectional area
A (i.e., area perpendicular to heat flow) and thickness L, the thermal conduction resistance Rcond is:
Rcond =
L
kA
(11.6)
For convection (characterized by heat transfer coefficient h) between a liquid or gas and a solid surface
with surface area A (A is the surface area exposed to the fluid), the thermal convection resistance Rconv is:
Rconv =
1
hA
(11.7)
Exercise 11.3
Use each of Eqs. 11.5, 11.6, and 11.7 to show that the units of thermal resistance can be expressed as
K/W. Conceptually, why does thermal resistance have these units?
Let’s consider tea cooling inside a thermos. This simplified thermos is completely full of tea and is made
of a styrofoam cup with a polypropylene (PP) lid. The heat flow diagram above shows that heat can escape
through two main paths: as shown in red, it can convect to the inner surface of the lid, conduct through it,
and then convect from its outer surface to air; as shown in blue, it can convect to the inner surface of the
styrofoam cup, conduct through it, and then convect from its outer surface to air. The dashed lines represent
the edges of the thermal boundary layers, which are the part of the fluid nearest the surface where thermal
gradients are concentrated (you’ve seen a thermal boundary layer if you’ve ever noticed how the air looks
CHAPTER 11. WEEK 4 HOMEWORK: SOLVING SYSTEMS OF FIRST-ORDER ODES
49
wavy or shiny just above an asphalt road in the sun). The thermal resistance network is a graphical way of
depicting how these two heat flow paths are in parallel, but that within each path there are resistances in
series; each node represents a surface or fluid at a particular temperature. R1 , R3 , R4 , and R6 are convection
resistances, while R2 and R5 are conduction resistances. The equivalent circuit (a single resistor) for this
mug is also shown.
The equivalent resistance for heat loss from the tea to the outside world can be expressed as two parallel
sets of resistors-in-series:
−1
Rtot = (R1 + R2 + R3 )−1 + (R4 + R5 + R6 )−1
(11.8)
1
Llid
1
1
L
1
−1
cup
= (
+
+
)−1 + (
+
+
)−1 (11.9)
hin Alid
kP P Alid
hout Alid
hin Acup
kstyro Acup
hout Acup
Several assumptions were made to simplify the model, including that the inner and outer areas of each
part were equal, that all surfaces were isothermal (uniform in temperature), and that there was no direct
conduction of heat between the cup and the lid.
If the inner tea and outer air temperatures were known (say, Ttea and Tair ), the total heat transfer rate
out of the thermos could be quantified as Q̇out = (Ttea − Tair )/Rtot .
Equivalent thermal resistance can be defined for any part of a thermal system where/when heat flows
steadily through that entire part of the system, i.e., there is no significant storage of heat. On the other
hand, when the flow of heat into and out of something are unequal (i.e., there is significant heat storage),
modeling heat flow and storage requires a thermal circuit including capacitors. Despite that limitation,
thermal resistance networks can be very useful in cases where part of the system (like the tea) act as primarily
thermal storage units, while other parts of the system can be treated as thermal resistances. Dense materials
like water, metals, and rocks tend to act primarily as thermal storage, while low-density materials such
as gases, textiles, and foams (along with convection between surfaces and fluids, including water) tend to
act primarily as thermal resistances. Steady (meaning not changing in time) heat flow through almost any
system can be modeled with a resistance network. In unsteady systems (like the tea cooling in a thermos),
resistance network modeling can’t be used for the entire system (i.e., you still have to consider the change in
energy of the tea over time), but it can be used to model parts of the system without significant thermal
storage, such as the thermos itself.
In the thermos example, the styrofoam has a very low density, and if we assume the polypropylene
lid is relatively thin (compared to the water), then the water has the greatest heat capacity of any part of
the system. We could treat the water as something that stores energy (with heat capacity C = mc) and
the thermos as primarily a thermal resistance (Rtot ). With these assumptions, the cooling of the tea in the
thermos could be modeled the same way as the cooling mug of tea in Assignment 1 (see Exercise 1.10 for
how a thermal system with internal energy storage and external resistance cools). The temperature of the
tea would decay exponentially toward room temperature with a time constant τ = (Rtot C), and it would
take longer because of the styrofoam’s high resistance.
If you would benefit from a lecture-style introduction to resistance networks to complement this written
introduction, Emily created this 14-minute video covering the basic concepts and an example (originally for
students in Transport Phenomena, not all of whom had taken QEA3 yet, but still a good video for QEA3 in
Emily’s humble opinion).
Humans generally need some kind of shelter, so let’s consider how thermal resistance network modeling
can help us estimate the heating bill of an apartment in the winter. The process of solving this problem is
similar to the one demonstrated in the previous example: sketch the system, draw in arrows for heat flows,
construct a resistance network that captures the parallel and/or series heat flow paths, and calculate the total
resistance. After that, you can calculate the total heat transfer rate using the formula Q̇ = (Thot −Tcold )/Rtot .
Exercise 11.4
You are considering renting an apartment, but are concerned about the energy consumption for
heating it. Fortunately, the apartment has only one external wall, which is an L × L square of
thickness δ and is made of a material with thermal conductivity k, density ρ, and heat capacity cp ;
CHAPTER 11. WEEK 4 HOMEWORK: SOLVING SYSTEMS OF FIRST-ORDER ODES
50
the other walls and the floor/ceiling are surrounded by other apartments, so you can neglect heat
flow through those walls. The internal convective heat transfer coefficient (between the wall and
inner air, which is it temperature Tin ) is hin and the external heat transfer coefficient (between the
wall and outside air, which is it temperature Tout ) is hout .
1. Create a resistance network and find a symbolic expression for the total resistance. (Hint: sketch
heat flows and create a resistance network. Are the convection and conduction resistances in
series or in parallel? Find the formulas for convection and conduction resistance earlier in this
assignment.)
2. What is the steady heat transfer rate, Q̇ out of the apartment through the front wall? Find a
symbolic expression.
3. If the wall’s effective thermal conductivity is k = 0.2 W/m-K and thickness is 10 cm, the heat
transfer coefficients are hin = 15 W/m2 -K and hout = 30 W/m2 -K, the wall is 4×4 m in size,
show that the total resistance of the apartment wall is 0.0375 K/W.
4. If the inner and outer average temperatures are 20 and 0 ◦ C, respectively, and heating costs
are 10 USD/GJ, estimate the heating bill (in USD per month) due to heat loss through the
apartment wall.
11.2.2
Bringing it all together
This problem asks you to model a system with flow and storage, reduce the number of ODEs by using
resistance networks, and solve a system of ODEs numerically.
Exercise 11.5
CHAPTER 11. WEEK 4 HOMEWORK: SOLVING SYSTEMS OF FIRST-ORDER ODES
Consider modeling the thermal behavior of an apartment that has one semi-insulated front wall, a
heated stone floor, and all other walls and the ceiling transfer no heat (perhaps they contact other
apartments at the same temperature). This front wall is made of red bricks, so it has a significant
heat capacity. Everything starts at 0 ◦ C and the heater embedded in the floor gives off 200 W of heat.
The outdoor air stays at 0 ◦ C. Let’s consider the floor, fiberglass insulation layer, and brick front wall
to each have an area of 10 m2 and a thickness of 7.5 cm. Heat transfer coefficients between air and
indoor surfaces can be assumed to be 15 W/m2 -K, while outdoor heat transfer coefficient can be
takes as 25 W/m2 -K. You can neglect direct conduction between the edge of the floor and the brick
wall. Approximate thermophysical properties, which you can use for this problem, follow.
Material
Brick
Fiberglass
Stone
Density (kg m−3 )
2000
12
2750
Specific heat (J kg−1 K−1 )
800
840
1000
Thermal conductivity (W/m-K)
0.6
0.04
3
1. Treating the brick and stone as pure thermal storage (no resistance) and the fiberglass and
air as pure thermal resistances (no storage), write a system of two ODEs for the temperature
of the brick wall and stone floor over time using generic heat capacities Cf and Cb for the
floor and brick wall, respectively, and and resistances R1 and R2 for the floor-to-brick overall
resistance and brick-to-outside-air resistance. In doing this, you may wish to refer to the recipe
for thermal system modeling that you created earlier.
2. Symbolically, and then numerically, calculate values for the heat capacities and resistances
(Cf , Cb , R1 , R2 ) in the system of equations, making use of resistance networks as needed.
3. Calculate the equilibrium temperatures of the floor and brick (this will help check that your
numerical solution makes sense by looking at the long-time behavior).
4. Use MATLAB’s ode45 solver (see function documentation for formatting) to solve the system
of equations and plot of the temperature of the floor and wall as a function of time for long
enough that the system almost reaches equilibrium. Include your code. Comment on the shape
of the curves, making sure to zoom in on the behavior when the system first starts heating.
What’s happening here?
5. Calculate the temperature of the air in the apartment as a function of Tb and Tf , which are
now known. (Hint: There are many ways to approach this, but you may find it helpful to
consider the resistance network between the floor to the brick and the analogy of a voltage
divider.) Add this to the plot above (you can submit a single plot to cover both sub-questions).
51
Chapter 12
Mini-project: First-order systems
12.1
Option 1: Passive solar house (yes, again!)
We invite you to design your dream tiny home for a carbon-neutral future! This project will allow you to
practice thermal modeling, setting up and solving ODEs, analysis-driven design, and technical writing. You
could even design an awesome house that you would want to live in.
We understand some of your have had experience modeling a solar house in ModSim. You also have a
new set of tools related to ODEs and thermal modeling. If this doesn’t appeal to you, there are other options.
We will ask each group of two or three students to turn in a written report.
12.1.1
House design requirements
• Size: 100-400 sq. ft.
• Reasonably comfortable in winter in Boston climate (between 17-25 ◦ C air temperature indoors)
• No direct sunlight through south-facing windows at noon in summer
12.1.2
Design choices
You must choose an insulation thickness and a heat storage unit (e.g., tile) thickness that will lead to a
comfortable house. Other decisions are optional.
• Insulation thickness (required)
• Heat storage unit thickness (required)
• Insulation material (base case material: fiberglass)
• Heat storage unit material (base case material: recycled ceramic tile)
• Other materials
• Window placement
• House shape
• Window orientation (facing south recommended)
• Style, layout, color, interior design, landscape design, etc.
52
CHAPTER 12. MINI-PROJECT: FIRST-ORDER SYSTEMS
12.1.3
53
What we will give you
• A house template, including dimensions you can use.
• An effective heat transfer coefficient of a double-paned window hef f = 1.4 W/m2 -K. This means that
the heat transfer through the window is Q̇window,out = hef f Awindow (Tinnersurf ace − Toutersurf ace );
you should still account for convection on either side of the window). We share this effective heat transfer coefficient to simplify modeling heat transfer through the window, which occurs in a complicated
network of conduction, convection, and radiation.
• Conductivity of fiberglass insulation (0.04 W/m-K)
• Density and specific heat of tile for energy storage unit (ρ = 3000 kg/m3 , c=800 J/kg-K)
• Typical heat transfer coefficients for indoor surfaces (15 W/m2 -K) and outdoor surfaces (30 W/m2 -K)
• Air temperature can be considered constant (T = −3◦ C)
• Normal component of solar flux through south-facing (vertical) window in winter (with sun at 25◦
from horizontal):
q = −361 cos(πt/(12 ∗ 3600)) + 224 cos(πt/(6 ∗ 3600)) + 210 (q in W/m2 ; t is in seconds). You may
assume that all radiation passing through the window is absorbed by the absorber/heat storage unit,
so that Q˙in is the product of the window-normal solar flux and the window area A: Q̇in = qA
• Angle of sun at noon in winter (25◦ from horizontal) and summer (72◦ from horizontal)
• Assumptions you can make:
– Heat capacity of the heat storage unit is much greater than the building envelope or the air inside
(however, you are welcome to design and model a house that has significant heat storage in the
envelope or other parts).
– Heat storage unit is at a spatially uniform temperature
– A negligible amount of air flows into or out of house
– Neglect radiation except solar radiation through windows
CHAPTER 12. MINI-PROJECT: FIRST-ORDER SYSTEMS
54
– All solar radiation hitting window is absorbed by heat storage unit, which is at uniform temperature. This also means the window is completely transparent to solar radiation and does not
absorb it.
– Air flows both below and above the heat storage unit (as if it was suspended; this is not physically
very realistic, but reasonably simplifies the model)
– Heat loss from the underside of the house matches that of the rest of the house (as if it was on
stilts)
12.1.4
Levels of challenge
The essential task is to optimize the design of a small passive solar house to be comfortably warm in the
Northeast. In the simplest implementation, you may:
• Use given house shape and materials (you might consider starting with 0.05 m-thick tile and insulation
and determining optimal tile and insulation thickness by informed trial and error)
• Model the house as having a single lumped heat capacity (e.g., a high-heat-capacity storage unit and
negligible-heat-capacity walls)
• You are welcome to build on your previous work in this class as well as posted solutions
• Clearly explain the physics and math behind the model your develop and the equations you solve
• Use MATLAB to numerically find the long-term periodic air temperature in the house
• Choose insulation and storage unit thickness such that the indoor air temperature stays comfortable
(within 17 - 25 ◦ C) and comment on how those design decisions affect house thermal behavior
• Turn in a brief report on time
We highly recommend that you first do the essential tasks above and document your work before adding
complexity to your project. (In the past, some teams had added a lot of complexity up front and ended up
spending much more time than desired.)
If you have created and documented a simple, working model of the solar house in winter, you can add
levels of fidelity/challenge/creativity, such as:
• Customize house shape or materials
• Model outdoor air temperature as sinusoidal, or even use real weather data
• Remove some assumptions and create a more complex model
• Design the house’s interior or landscape
• Model performance in summer
• Explore another aspect you’re curious about
The above possibilities aside, we wish to emphasize that you do not need to add additional complexity to
the house design or the model. Creating a simple model of a simple passive solar house that captures the
effects of insulation and heat storage—and enables you to clearly explain those effects using ODE concepts—is
a fine approach to the project.
CHAPTER 12. MINI-PROJECT: FIRST-ORDER SYSTEMS
12.1.5
55
Report requirements
Turn in a short, carefully constructed final report with the following sections:
• Background: In a paragraph or two, introduce your project. What is a passive solar house, and why
would someone build one? What are the basic working principles of passive solar houses? What is
your team’s approach to designing/optimizing a passive solar house for Massachusetts? You should
reference at least two sources in this section.
• Modeling: clearly explain the model using at least one graphic as well as equations and words. (Note:
Screenshots of code may not substitute for explaining your model.) List major assumptions you made
in modeling and why they are reasonable. Include the complete system of equations that comprises
the model as well as any key material properties (e.g., if you use a unique insulation material, list its
thermal conductivity); a table may be well-suited to listing material properties. Reference and explain
all equations in the text.
• Design and optimization: Using a diagram and words, describe the design of the house. Include key
dimensions and materials. If you use the default house design, you have our permission to include
the diagram from this project description and cite this assignment as a reference. Choose values for
flexible parameters in your house design (at the minimum: thickness of insulation and heat storage
unit) that lead to reasonable comfort (within about 17-25 ◦ C air temperature indoors). Describe how
these parameter values were chosen. These questions must be answered:
– How does the storage unit thickness affect the house’s thermal behavior, and why?
– How does the insulation thickness affect the house’s thermal behavior, and why?
You may (but do not have to) use plots or figures to help answer the questions above.
If you changed anything else about the design (besides thickness of insulation and heat storage unit),
explain what you did, why, and how it affected the performance of the house.
• Results and discussion:
– Plot the solution for house temperature with your chosen parameters over a long enough time
period that the solution approaches a periodic solution and with hourly (or finer) time resolution.
Discuss the plot in the text.
– Plot the temperature over a single 24 hr period after the house has reached a consistent (periodic)
temperature pattern. Annotate this plot with the minimum and maximum temperature the house
reaches during the (winter) day. Discuss the plot in the text. How does your house compare to
typical dwelling temperatures?
– Discuss: Considering your experiences with different temperatures, how would a person living
in this house feel? What future improvements would be necessary or desirable to make this
house comfortable?
• References: Include a list of three or more references (other than the QEA workbook) in any common
formal style, such as IEEE or MLA. Cite references where used in the text by reference number or
author/year, depending on your chosen reference style.
12.2
Option 2: Could floatovoltaics save a lake?
We invite you to investigate the shrinking of Lake Mead and explore the effect of floating photovoltaics
(“floatovoltaics”), which have been proposed as a potential solution to evaporative water loss. This is an
opportunity to use ODEs to explain the behavior of an important water source for the American Southwest
and predict the effect of a technological intervention.
This project option is new and minimally scaffolded. Each group of two or three students will turn in a
written report.
CHAPTER 12. MINI-PROJECT: FIRST-ORDER SYSTEMS
12.2.1
56
Report elements
Background
In just a paragraph or two, introduce your project. Example questions to consider: What is the current
situation with Lake Mead? What is the proposed change? Why does it matter? This section should include
citations in the text to at least two outside sources of information.
Modeling
• Using a clear, diagrammatic way of documenting fluid flows, create a captioned figure illustrating
conservation of water mass for Lake Mead. Explain.
• Write the system of equations, including at least one ODE, that will be used to solve for lake volume
and/or height as a function of time. Explain these equations in words, including why they are
appropriate for modeling the system of interest. Make sure at least one of the non-differential terms
in the primary ODE is not a constant1 . Make note of important assumptions and justify why they are
reasonable. Include variable definitions and values.
• Discuss the primary ODE for your system. What type of ODE is it? What type of behavior do you
expect from an ODE like this?
• State how you will solve the system of equations, including any initial values.
Validation
Using data and trends for Lake Mead, show that your baseline lake model (without floatovoltaics) is reasonable.
This will lend credibility to non-baseline predictions.
Results and discussion
Show, explain, and discuss the results of your model. Include, at the minimum, a plot of lake volume and/or
height over time with and without floatovoltaics. Make a recommendation based on your findings and
discuss the potential impacts of the recommended path. You may optionally choose to add conclusion section
summarizing findings.
References
Include a list of three or more references (beyond the QEA3 workbook) in any common formal style, such as
IEEE or MLA. Cite references where used in the text by reference number or author/year, depending on
your chosen reference style.
12.3
Option 3: Choose your own application
Are you interested in a particular system or application that involves a flow of something and might,
therefore, be amenable to modeling with first-order ODEs? Then this non-scaffolded option might be for
you. Applications related to hobbies, research, project teams, and personal interests are all possible.
In this option, the deliverable would be a report, minimally containing the following (or comparable)
sections: Background, Modeling, Results Discussion, and References. The modeling section should include a
full description of the equations developed to model the system, including what they mean and why they are
appropriate. The model should include at least one first-order ODE, and the type and behavior of that ODE
should be discussed. In your modeling, you should explore the effect of at least one change to the design,
1 For example, you could model evaporation rates as varying with lake area as volume increases, changes in water demand over
time, or changes in evaporation rate with temperature due to climate change. Having a non-constant term makes sure this will be a
differential equation with interesting behavior, as working with ODEs is important in this class, and it also encourages you to look
beyond the simplest possible model.
CHAPTER 12. MINI-PROJECT: FIRST-ORDER SYSTEMS
57
operation, or environment. The results section should include at least one plot of predicted system behavior.
It will be up to you to demonstrate in your report that you have applied the skills of modeling and predicting
system behavior with ODEs.
12.3.1
Modeling with ODEs competition
For the past five years there has been a "Modeling with ODEs" competition organised by a group called
SIMIODE (Systematic Initiative for Modeling Investigations and Opportunities with Differential Equations).
The following problem was used in the competition last year and may be of interest to you. This would be a
system you could investigate for this project option.
12.4
Option 4: Textbook on Modeling with ODEs
There is a very nice digital textbook called "Differential Equations: A Toolbox for Modeling the World" by
Kurt Bryan. You can find a purchased version of it here, which you can access for occasional educational
use: if you like the book we recommend you buy it.
The following chapters are relevant to us, and we have covered roughly the same material.
• Chapter 1: Why Study Differential Equations?
• Chapter 2: First-Order Equations
• Chapter 3: Numerical Methods for ODEs
• Chapter 6: Linear Systems of Differential Equations
12.4.1
Option 4a: Textbook Reading and Problems
In order to solidify your knowledge, you could choose to read these four chapters from the book and complete
some exercises from each section. We expect that you will choose a substantial number of exercises and that
some of these will go into significant depth. You will be able to propose and get feedback on what set of
exercises you will complete. As your deliverable, you would turn in a detailed summary of the chapters and
answers to a selection of the exercises.
12.4.2
Option 4b: Modeling Projects
Alternatively, if you feel pretty solid on the concepts, you could tackle in detail any of the modeling projects
from chapter 3.5 or one of the first two modeling projects from chapter 6.5. You would then turn in a detailed
set of responses to the modeling project.
12.5
General report-writing tips:
If your project involves writing a report (as options 1 through 3 do), aim for clarity, conciseness, and
professional technical writing style. Equations, prose, and diagrams should be clear enough that any Olin
student could easily understand your work. Equations should be written clearly (using an equation editor),
in mathematical form (not code), and explained in the text. Any variables used should be defined. Diagrams
should be captioned. Screenshots (of code, tables, etc.) should not be included. Quantities that have units
should always be listed with those units (e.g., "thermal conductivity of 5 W/m-K").
To avoid plagiarism, include references to any external sources you use, and also use quotation marks
around any phrases four or more words in length (except for very common phrases like "four or more words")
that you borrow from other sources. Finally, we recommend that you read the rubric on Canvas that explains
how report will be assessed, and ask the teaching team early on if the assignment or rubric are unclear.
Part II
Shake It Up: Analysis of Oscillatory
Motion
58
Chapter 13
Week 7, Day 2: Free Body Diagrams
and Equations of Motion
Learning Objectives
Concepts
• Apply appropriate analytical models for various forces.
• Divide a system into appropriate component subsystems and draw accurate free body diagrams.
• Compute net force and/or torque acting on a body from multiple known forces and/or torques.
• Compute reaction forces for an object in static equilibrium.
13.1
Free Body Diagram (FBD) In-Class Practice
Exercise 13.1
Some cats like to ride on Roombas. Let’s say we want to train Boots the cat to ride on a Roomba. We
place him on top of a stationary one, but he jumps forward and up onto the couch. Draw an FBD of
Boots: (a) Jumping in the instant before leaving the ground and (b) in midair.
What forces is Boots exerting? What forces are acting on him? (Only include the forces acting on
him in your FBD!)
Exercise 13.2
1. We bribed Boots with treats and he will now ride the Roomba. Draw a free body diagram
of Boots as he rides along on his robot friend. What forces are acting on him? How would
the magnitude of the forces relate if the Roomba is moving at a constant speed? What if it is
accelerating?
2. Draw two more FBDs: for the roomba only and a final one for the Boots-Roomba system. How
do these compare with your diagram for Boots only?
3. Why might you draw these different diagrams? What different information could they give
59
CHAPTER 13. WEEK 7, DAY 2: FREE BODY DIAGRAMS AND EQUATIONS OF MOTION
60
you?
Figure 13.1: A depitction of Boots on a Roomba courtesy of Meagan Martin (’24)
13.2
Review of Static Equilibrium
We’ll spend most of QEA3 working with dynamic systems, but first let’s get some practice with static
problems. This is review of material from QEA2, but provides an important foundation for system analysis.
A system is said to be in static equilibrium when the net force and net torque on every part of the system
is zero. The two conditions for equilibrium lead to the following basic equations:
X
F⃗ = 0
X
⃗τ = 0
In QEA2, we worked through several problems with loaded beams. Let’s look at a slightly more complex
example with a distributed load. If you need a refresher on the reaction forces at various simple supports,
a comprehensive table of simple supports is in Table 6.1 in sections 6.1 and 6.2 of Sheppard and Tongue’s
Statics: Analysis and Design of Systems in Equilibrium textbook. You’ll see that a pin joint has no reaction
torque.
Exercise 13.3
The wooden beam shown in Figure 13.2 is pinned to a wall at A and supported by a rope at B. If
the beam supports a distributed load as shown (the beam itself does not add additional mass in this
problem):
1. Simplify the distributed load into two point loads, F1 and F2 . Let F1 represent the equivalent
point load for the varying load from A to C, and let F2 represent the equivalent point load for
the constant load from point C to B. Find the the magnitude and position of each point load.
2. Find the reaction forces at A and the tension in the rope at B.
CHAPTER 13. WEEK 7, DAY 2: FREE BODY DIAGRAMS AND EQUATIONS OF MOTION
Make sure to draw the free body diagram, which will help you set up your net force/torque equations.
You will ultimately solve for the numerical values of the forces and torques.
Figure 13.2: Wooden beam with distributed load given by ω.
Exercise 13.4
A block of mass m hangs from a cantilevered beam of length L by an ideal spring with spring
constant k. When the spring is not stretched, the spring has length l, and at static equilibrium, the
spring has length l◦ . We wish to know reaction forces and torques at the wall and the force exerted
by the spring.
1. Draw as many FBDs as you need to solve this problem (hint: you need more than one). Include
reference frames.
2. Use Newton’s second law to write out the equations for net force and net torque. You can
assume the spring is stretched beyond its neutral length. You may need to define some
dimensions (such as the distance from the wall at which the spring is attached to the beam) on
your FBD.
For example, for the net force equation for the beam in the x direction, you could write:
X
Fnetx =
Fx = Frx = max
where Frx is the x-direction reaction force from the wall.
61
CHAPTER 13. WEEK 7, DAY 2: FREE BODY DIAGRAMS AND EQUATIONS OF MOTION
13.2.1
62
Looking Forward (if you have extra time)
In the last statics problem, we analyzed a mass on a spring connected to the end of a fixed beam. Since the
system was at equilibrium, it is fairly easy to solve. What happens if we take away that constraint - e.g. if
we pull the spring past its equilibrium point and then let go? What do you think the motion of the system
look like? Discuss with your group!
Exercise 13.5
To draw a connection back from Module 1, you might think of equilibrium as our “steady state" for a
dynamic system. What does this mean, in your own words? Explain it to a partner and discuss with
your group. Consider using the spring/beam as an example.
Note: The beam/spring is actually a somewhat complex problem to analytically solve, but we’ll work
towards it as we dig into spring-mass-damper systems.
Chapter 14
Week 7 Homework: Physics Practice
Problems
14.1
Review of Forces, Torque and Free Body Diagrams
Exercise 14.1
Take some time to review forces, torque, and free body diagrams. There is a guide here started by
former QEA3 students. You may also want to review your notes or Mark Somerville’s videos from
QEA2.
14.1.1
Torque
You encountered the concept of torque during the “Boats” module in QEA2. As a reminder, the mathematical
definition for a torque is given as:
⃗τ = ⃗r × F⃗
which relies on the cross product. Looking at the equation for a torque, there are several important characteristics we notice immediately:
1. A torque, ⃗τ is a vector, meaning that it has both a magnitude and a direction. You can use the Right
Hand Rule to figure out what direction the vector is pointing.
2. Both ⃗r and F⃗ are vectors, so both magnitude and direction matter.
3. Torque is the cross product between ⃗r and F⃗ , so its magnitude is maximized when ⃗r and F⃗ are
perpendicular.
The ideas we will be exploring in these exercises are also in the videos about the definition of torque and
choice of origin if you would like to review.
14.1.2
Free Body Diagrams
Note: All of the following material can be found in the FBD walkthrough from the last exercise.
However, we’ve left the text as a resource just in case.
We have seen free body diagrams throughout QEA, starting in the “Boats” module and reappearing in
the “Robots” module’. Here, we will revisit the basics of free body diagrams (FBDs), including reaction forces.
Exploration of mechanical systems require asking a series of questions:
• How will the system behave? (Play the movie in your head or describe what you think will happen.)
63
CHAPTER 14. WEEK 7 HOMEWORK: PHYSICS PRACTICE PROBLEMS
64
• What are the aspects of the system you care about?
• What interactions do you need to capture in your analysis? (I.e., what are the forces and/or torques
acting on the various parts of your system? Are these forces/torques captured in your free body
diagrams?)
How you choose to visualize your system and its components can impact your ability to understand
and ultimately complete your analysis. Clear and complete free body diagrams, can help you 1) clarify your
understanding of the system(s) 2) derive appropriate equations of motion, 3) quickly evaluate the
accuracy of your work, and 4) get help from others (because they can visualize your understanding the
system!).
For your next steps:
• Make a decision as to which system (a body or collection of bodies) you will be analyzing. You may
identify the need to break your system into multiple subsystems. Each FBD should be one system with
a set boundary. It helps to choose a boundary that cuts across a force you want to calculate (such as
the tension on a rope). Sketch the system.
• List the forces and/or torques are exerted on the system you have chosen, e.g., gravitational force,
normal forces, friction, drag, etc. Generally, applied torques should only be used for torques applied
over a relatively small area, e.g., by a motor shaft or screwdriver; your FBDs will usually mostly consist
of forces. Only forces that act across the system boundary should be included; forces that are completely
internal to the system or external to the system do not belong in an FBD.
• Draw and label ALL forces and applied torques that act on the chosen system using arrows acting on
the appropriate locations on the system, with appropriate directions when known. Arrows can either
begin or end at the locations where forces act; just be consistent. (Note: You may need to arbitrarily
assign a direction at times. Your analysis will help you identify whether the guessed direction was
correct; if the magnitude of that force turns out to be negative, that’s OK—it just means the force acts
in the opposite direction from your assumption.)
• Choose and label reference frames. Each FBD should have a coordinate system attached. For example,
14.1, shows the the positive x and y directions. They don’t give a specific origin, but instead choose to
label specific points (A, B, G), and can use those as reference points. In our practice problems, we’ll
try to consistently give an origin, but these additional reference points can also be useful e.g. when
calculating moments around different points.
In Figure 14.1 below is an example of how a real-world scenario was abstracted to an idealized system,
and ultimately to a free body diagram.
CHAPTER 14. WEEK 7 HOMEWORK: PHYSICS PRACTICE PROBLEMS
65
Figure 14.1: The image of the ramp is reduced to an idealized example in the center figure and finally a free
body diagram in the final figure on the right. G is the gravitational force, T is the tension force from the
cable, and Ax and Ay are reaction forces at the pin joint. Images reproduced from this lecture.
14.2
Statics Practice
Note: We’ve given you some problems with real values. We would like you to practice solving everything in
terms of variables, and then plugging in numbers afterwards.
Exercise 14.2
In class we found the equations of motion for the system below. Use them to find the reaction
forces/torques at the wall and the distance (yf ) between the block and the beam at static equilibrium.
The beam has length L and mass mbeam , and the spring (with spring constant k) is attached to the
beam at distance xspring from the wall. The block is distance y = yo below the beam when the
spring is at its neutral length.
Exercise 14.3
You want to make a simply supported shelf (i.e. like the one pictured above, where the supports only
act in the y direction). The shelf is for your cat, who weighs 6 kg. The shelves are 0.5 m long and
weighs 0.5 kg.
1. What is the maximum reaction force in each support? (i.e. imagine your cat sitting in a couple
CHAPTER 14. WEEK 7 HOMEWORK: PHYSICS PRACTICE PROBLEMS
66
different locations on the shelf. What is the worst case scenario? How do you know?)
Exercise 14.4
A car on a long road trip is hauling a trailer to the rubber duck expo. Each giant rubber duck has
mass md = 50kg, the trailer overall has mass mt = 1300kg, Draw a free body diagram for the
trailer. The ducks are each 0.5 m from the wheel axle. Assume the car and the trailer are moving at a
constant speed v, and the force from the car is Fcar , which only acts along the x-axis. The trailer
wheels have some rolling resistance Crr = 0.02 which causes the axle to pull on the trailer body
with Frr = Crr FN where Frr rolling resistance and FN is the normal force on the wheels.
1. Draw a FBD for the trailer. You can ignore drag for this problem.
2. If the car is going 50 mph, how much force does it pull with on the trailer (what is Fcar )?
3. If we attached a spring between the car and the trailer, and it stretched 0.05 m past its equilibrium length, what would be its spring constant k?
14.3 Optional: Additional Resources and Readings
The readings and exercises attached are from a previous version of MODSIM, and provide a walk through of
analyzing a system, setting up free body diagrams, and writing equations of motion. These are a great way
to get another perspective on Free Body Diagrams especially if you’re feeling rusty, but are not required.
Exercise 14.5
Qualitative Analysis of Mechanical Systems
Based on the reading above, please consider the following questions:
The Falling Cat
1. How is the cat abstracted? (E.g., point mass, rigid body...)
2. What are the forces and/or torques acting on the cat?
3. What is the free body diagram for the falling cat? Please draw this out in your solution.
Exercise 14.6
Read the section “Fundamental and Approximate Mathematical Models for Interactions” in the
document Quantitative Analysis of Mechanical Systems
CHAPTER 14. WEEK 7 HOMEWORK: PHYSICS PRACTICE PROBLEMS
Based on the reading, make a cheat sheet with equations and/or an explanation on how you would
model:
• A spring force
• Gravitational force
• Inertial drag
• Viscous drag
• "Normal" force
• Static friction force
• Dynamic friction force
Make sure to define your variables in any equations!
Exercise 14.7
For the following questions, answers can either be found in the “Equations of Motion” section in the
document Quantitative Analysis of Mechanical Systems, or you can use a reference of your choice.
1. What is linear momentum?
2. What is angular momentum?
3. What is the second law involving linear momentum?
4. What is the second law involving angular momentum?
67
Chapter 15
Week 8, Class 1: Equations of Motion
and Second Order ODEs
Learning Objectives
Concepts
• Build equations of motion for dynamic systems, particularly oscillatory systems.
• Recognize the qualitative impact of damping on an oscillatory system.
• Find the characteristic equation for a linear second order differential equation.
• Determine the roots of the characteristic equation as the eigenvalues of the matrix of the
corresponding system of first-order linear ODEs.
• Identify if the roots are either both real but distinct, real and equal, or complex.
• Use the roots of the characteristic equation to determine whether an oscillator is underdamped,
overdamped, or critically damped.
15.1
Homework and FBD Debrief
Exercise 15.1
(Time goal: 10 min)
With your table, go through the solutions to the homework due today. Identify which of these
concepts you feel comfortable with and which are still confusing.
Try to resolve your confusions (about topics or specific problems) with the folks at your table and by
talking to an instructor.
15.2
Introduction to Equations of Motion
In QEA2, we generally focused on systems at rest and satisfying the conditions for static equilibrium. Now
we will begin analyzing systems that are not in static equilibrium, and where parts of the system may be
undergoing a change in linear or angular momentum. Before we do so, let’s make sure we have a strong
understanding of static systems.
68
69
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
Exercise 15.2
Static Equilibrium Conceptual Questions
1. If a system is at static equilibrium, what does that say about the linear and angular acceleration?
2. For a system to be in static equilibrium, does it need to be at rest? Why or why not?
3. For a 2D (x,y) system, how many equations are needed to prove static equilibrium? Please
write them. How many are needed for a 3D (x,y,z) system?
4. What is the maximum number of unknown forces and/or torques in a 2D system? How do
you know this?
5. With your group and using your notes from the last assignment, come up with a cheat sheet
or recipe for for analyzing systems in static equilibrium. Include any relevant equations and
steps. What might you need to change when analyzing a system in motion?
To generalize our processes of analysis for dynamic rather than only static systems, we will need to
make a few adjustments to our prior recipes for static equilibrium. This might include steps such as drawing
your system at multiple points in time. Here is our recipe for analyzing dynamic systems:
1. Storyboard at least three frames for your system (if moving).
2. Draw the free body diagram (FBD) for the system and/or appropriate subsystems. The FBD should
include the relevant reference frames and coordinate systems, as well as neatly drawn and labeled
force vectors and torques.
3. Formulate appropriate models for the forces/torques acting on your system.
4. Decide if you will be treating the system as dynamic or static. This may be based on knowledge of the
net force and net torque acting on the system, or based on knowledge of the motion of the system.
P⃗
P
⃗
p
5. Write out the equations of motion at the most abstract level: d⃗
F and ddtL =
⃗τ . These
dt =
equation’s are Newton’s second law and the angular equivalent.
6. Substitute your mathematical equations for forces/torques into the right hand side of the equations
above.
7. Decompose vector quantities into relevant components (e.g. x and y or r and θ ) based on the chosen
coordinate systems.
8. For a system in static equilibrium, evaluate unknown reaction forces. For a dynamic system, evaluate
the equations of motion for the system’s state variable(s).
15.3
Motion of a Spring-Mass System
As we move forward with dynamical systems, the net force and net torque are not necessarily equal to zero.
To analyze these systems, we will need to apply Newton’s second law and its rotational equivalent. We’ve
already used these in statics, but now we can no longer assume that we can set these equal to zero!
d⃗
p X⃗
=
F
dt
(15.1)
X
⃗
dL
=
⃗τ
dt
(15.2)
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
70
The spring-mass, shown in Figure 15.1, is a canonical system for studying dynamics (along with the
mass-spring-damper system we will see later). It is an example of a harmonic oscillator, a system that
experiences a restoring force when displaced from its equilibrium position.
Exercise 15.3
Spring-mass and spring-mass-damper systems are canonical systems which sounds very fancy but
why do we care? Well, springs and spring-damper systems are everywhere, and not just in slinky-like
form that we’re used to seeing in text books.
Brainstorm some spring and spring damper systems (or systems that can be modeled as springdampers). Some examples might be your car or bike suspension, or a cantilever beam!
Exercise 15.4
Looking at the spring-mass system in Figure 15.1, a key step in writing an equation of motion is
choosing the state variable(s) (the quantities we care about and want to track) and coordinate system.
For the one-dimensional spring-mass system in Figure 15.1, we will choose the horizontal position
of the mass as our state variable.
1. For the spring-mass system in Figure 15.1, you could choose to put your coordinate system
anywhere but we chose the center of the mass at xeq ? Why do you think we did that?
2. Write the spring force on the block (a vector) as a function of the block’s position.
15.3.1
Storyboarding the Mass-Spring System
When considering a dynamical system, gaining a qualitative understanding of the scenario with respect to
time is the first step for analysis. To do this, we will storyboard the scene, drawing the system at multiple
moments in time. Using these sketches, we can draw multiple free body diagrams to gain an intuitive
understanding of the forces/torques acting on the system.
For the following exercises, we will continue to use the spring-mass oscillator with no friction, as shown
in Figure 15.1. Note: in Figure 15.1 we have chosen the state variable r(t) to be the horizontal deviation
of the mass from the equilibrium position xeq in meters. This choice of state variable and origin means
Fs = −kr(t)x̂ in Newtons.
Figure 15.1: Spring-mass system with no friction.
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
Exercise 15.5
Below, you will find an example of four storyboard frames that show the motion of the mass
throughout half of one oscillation.
1. Please draw your own storyboard on the board as a group. You’ll probably want at least 3;
each person might draw one frame.
2. Draw a FBD for your frame.
3. Write the equations of motion (
P⃗
F = m⃗a) together.
4. What changes for the different FBDs? Do you need to account for this in your equations of
motion?
71
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
72
73
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
15.3.2
Visualizing Solutions to Governing Equations
Recognizing a second-order ODE Based on the free body diagram, Newton’s second law gives us the
following equation of motion for the spring-mass system (in which p is linear momentum and dm
dt = 0, i.e.
the mass does not change over time):
X
Fx =
dr
Recognizing that vx = dx
dt = dt and ax =
derivative of the state variable r(t).
m
dpx
dmvx
=
= max
dt
dt
d2 r(t)
dt2 ,
(15.3)
we can write the acceleration of the mass as the second
d2 r(t)
= −kr(t)
dt2
(15.4)
You might also rewrite it as:
k
r(t) = 0
(15.5)
m
The equation of motion above is the governing differential equation for the spring-mass system, and it is
a second-order ODE. To be specific, this is a linear, second-order, homogeneous ODE. Think about what each of
those terms means and why they apply to this equation. You can check out the video here to learn more
about this type of equation.
Now that we know the spring-mass system is an example of a linear second order homogeneous
differential equation, it is useful to build some intuition around the behavior of the system in the time
domain, and relate that to possible solutions of the governing ODE.
r′′ +
Exercise 15.6
1. As a group, sketch the spring force, and the position, velocity, and acceleration of the mass as
a function of time. We recommend lining up your plots if possible as in Fig15.3.2 and starting
with r(t).
2. How do the different plots relate to each other? (e.g. Force to acceleration, acceleration to
velocity and position, etc)
3. What types of function(s) would be a good guess for a solution to the governing ODE (i.e.
r(t) = ...)?
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
74
Exercise 15.7
Go to this site and confirm your intuition using the harmonic oscillator simulator. For now, set
the damping equal to zero. You can use the “time graph” page to simultaneously plot the position,
velocity, and acceleration.
15.4 HOMEWORK/READING FOR NEXT CLASS (About 30 minutes)
Please do this sometime before the next class. Feel free to start during today’s class if you have extra time.
You do not have to turn anything in, but we invite you to do this work for your own learning and to be
prepared for the next class.
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
75
Figure 15.2: A damper is added to the spring-mass system to model non-conservative forces that are
proportional to velocity, such as friction.
15.4.1
Damped harmonic oscillator: qualitative behavior
If the mass slides on a frictionless surface, no energy is dissipated as the mass oscillates. The spring force
in the spring-mass system is a conservative force, and we would expect the mass to oscillate at a constant
amplitude for all time if given an initial perturbation. In reality, it is almost impossible to have a conservative
system because of the presence of non-conservative forces like friction.
Consider the spring-mass system in Figure 15.2, this time with a friction force present at the interaction
between the block and the surface. To model the non-conservative friction force, we add a damper to the
system with damping force F⃗f ric = F⃗damp = −b⃗v (t), which is proportional to the velocity of the block
⃗v (t), and has damping coefficient b.
Exercise 15.8
1. Qualitatively sketch the damping force and the position, velocity, and acceleration of the mass
in Figure 15.2 as a function of time.
2. Compare the time domain plot you drew for the damped harmonic oscillator to the time
domain plots of the undamped oscillator. What similarities do you notice between these plots?
What differences exist?
3. Based on the time domain plots, can you guess the form of the function that describes the
position of the damped oscillator?
CHAPTER 15. WEEK 8, CLASS 1: EQUATIONS OF MOTION AND SECOND ORDER ODES
76
Exercise 15.9
Return to the simulator here and again confirm your intuition. This time, set the damping equal to
some non-zero value. You can use the “time graph” page to simultaneously plot the position, velocity,
and acceleration. It is also interesting to look at the “total energy” either on the “Sim” page, or as
part of the “time graph.” What do you notice?
15.4.2
Reading: Accelerometers and motion
In our next class, we will begin working with a powerful sensor embedded in smartphones: the accelerometer.
As the name implies, an accelerometer measures acceleration; however, it’s important to understand which
body’s acceleration is being measured. Please use the resources provided and/or look up your own sources
to learn about the MEMS (microelectromechanical system) accelerometer embedded in virtually all modern
smartphones.
At the heart of a MEMS accelerometer is a spring-mass system. By using Hooke’s law, we can relate
the
P displacement of a spring to the force acting on the attached mass. Using our equations of motion,
F = ma = −k(x − x0 ), we can measure acceleration. MEMS technology is what allows us to build a
small enough spring-mass system that we can place it on an integrated circuit, which can be contained in a
smartphone.
The most common MEMS accelerometer is a capacitive accelerometer. Here are a few different resources
to learn more:
• A quick animation that shows the basic idea is given in this video (recommend starting at 0:20).
• A slightly longer explanation can be found in this video up til 2:00, watch til the end if you’re curious
about how MEMS accelerometers are manufactured.
• This video is a slightly longer explanation that also includes information about other types of sensors.
Exercise 15.10
To collect data, you will need either the Matlab app or a similar app such as PhyPhox. Please go to
this page for more information on the Matlab app and make sure you can run and access the data from
the accelerometer in some format. If these options won’t work on your phone (like if your phone’s
OS won’t support these apps), please contact the teaching team and we’ll figure it out together.
Chapter 16
Week 8, Class 2: Accelerometers and
Gathering Motion Data
16.1
Solving 2nd-Order ODEs Mini Lecture
16.2
Accelerometers and Motion
In your homework, you watched some videos and looked up resources on how a MEMS capacitive accelerometer works. For this set of problems don’t worry about the sign of the accelerometer value, the convention
used for the sign is dependent on the phone’s coordinate system, and we’ll delve into that a bit later.
Exercise 16.1
1. Explain to your group or in pairs how the accelerometer works. We encourage you to sketch
on paper or on the whiteboard.
2. Assuming the accelerometer axis is aligned with gravity, what value will your accelerometer
read if it is sitting stationary on a table (assume units of m/s2 )?
3. Now suppose you were holding this accelerometer (still aligned with gravity) and you accelerate
the unit downwards, what value (approximately) will your accelerometer read (assume units
of m/s2 )?
4. Suppose you drop the accelerometer off a building, what value will your accelerometer read
(assume units of m/s2 )?
5. Suppose that falling off the building is followed by the accelerometer hitting the ground. Draw
a graph of the accelerometer readings over time.
6. Now suppose the axis of the accelerometer is 10 degrees off from the axis of gravity. How does
this change affect the readings when the phone is stationary?
16.3
Spring-Mass Carts
We’ve spent time sketching out envisioned motion for a spring-mass and spring-mass-damper system. Let’s
take some data and analyze these systems experimentally!
77
CHAPTER 16. WEEK 8, CLASS 2: ACCELEROMETERS AND GATHERING MOTION DATA
78
Exercise 16.2
Place a phone on the cart and collect accelerometer data for a simple spring-mass-damper system.
Note:
• Our springs don’t work very well in compression, so instead we will attach springs on either
side of our carts.
• You can use either Matlab or PhyPhox, but we recommend trying out PhyPhox (acceleration
with g for raw data) first, so you can visualize data quickly and try a few options.
Try a few different initial conditions. How do your plots of acceleration change based on the initial
conditions? Save one dataset.
16.4
Frequency Response and the Return of the DFT
You may have noticed that when you have a mass with a spring alone and no damping, the mass oscillates
with a regular frequency.This is referred to as the “natural frequency” of the spring-mass system. When
you add a damper, provided the system is underdamped, you will still see oscillations, now at a frequency
which is shifted from the natural frequency. Let’s calculate the natural frequency of our system and see if
our experiments provide the expected results!
Exercise 16.3
1. Take one of the extra springs. Using the equipment provided, figure out a way to measure the
spring constant of this spring.
2. Using the provided scale, weigh a cart to get the mass. You may also want to weigh your
phone.
p
3. Predict the natural frequency of this spring-mass system, which is k/m. You’ll need to think
about how to incorporate the fact that you are using two springs.
Exercise 16.4
Load your data into Matlab and plot the acceleration vs. time. See if you can estimate your spring-mass
system’s natural frequency using the time plot first.
Next use make_freq_plot.m to plot your data from your spring-mass in the frequency domain. You
will need your sampling frequency (fs), which for PhyPhox is 100 Hz. Where is the highest peak?
Does your measured natural frequency match your predicted value?
16.4.1
Euler’s Method
We’ve just been plotting acceleration of our carts, whereas our state variable and solution to our ODE
describing motion is the position. How can we find our position from acceleration data? (Hint: You did
something very similar in QEA2 when you found position from velocity).
CHAPTER 16. WEEK 8, CLASS 2: ACCELEROMETERS AND GATHERING MOTION DATA
79
Exercise 16.5
1. Work with your group to map out how you would plot your position and velocity from your
acceleration data (i.e. remind yourself of Euler’s method for numerical integration). Write out
some equations and/or pseudocode.
2. Optional/if time: Write some matlab code and plot your position, velocity and acceleration
for one dataset. You can use make_time_plot.m if desired. Compare this to your sketches from
last week. Do your predictions match?
16.5 Looking ahead: Intro to Nonhomogeneous Second Order ODEs
Exercise 16.6
Let’s take one more dataset. This time, hang your phone vertically from the spring (you can use the
rubber bands provided), and have a fellow classmate pull on it slightly to make it oscillate. (Note:
please try to keep your phone in the same orientation, or at least keep track of the orientation and
how that affects your data.)
1. Write equations of motion for the phone on a rubber band. How is this system different from
the cart with springs? How is it similar?
2. What similarities and differences do you notice in the hanging phone’s acceleration plot
relative to the cart’s? How do you think your solution to your ODE (i.e., the position you
would calculate from acceleration) will be affected by the presence of gravity along the axis of
motion?
16.6
Optional Bonus: More springs!
Exercise 16.7
We know about how to add resistors in parallel and in series. How do you think springs act in parallel
or in series? Use your intuition and FBDs to make a prediction and then test it out with your group.
Chapter 17
Week 8, Homework: Solving
Second-Order ODEs
17.1
Systems of first-order linear ODEs
The general form of a linear, second-order, homogeneous ordinary differential equation looks like this:
ay ′′ (t) + by ′ (t) + cy(t) = 0
(17.1)
for some constants a, b and c.
We are going to compare this second-order ODE to a system of two coupled, linear, first-order ordinary
differential equations with constant coefficients,
y1′ (t)
= a11 y1 (t) + a12 y2 (t)
y2′ (t)
= a21 y1 (t) + a22 y2 (t).
(17.2)
These should look familiar; we saw systems of first-order ODEs at the end of Module 1 in section 11.1.
We also wrote it as a matrix product,
y′ (t) = Ay(t).
(17.3)
17.1.1
Converting from second-order to first-order
You can convert from a second-order ODE of the form (17.1) to a system of coupled first-order equations of
the form (17.2).
Let’s define two variables y1 = y and y2 = y ′ . Substituting these into the second-order ODE (Eq. 17.1)
leads to
ay2′ + by2 + cy1 = 0
Re-arranging this and recalling the definition of y1 gives us the system of ODEs (written in the form of Eq.
17.2)
y1′
y2′
17.1.2
=
0y1 + 1y2
b
c
= − y1 − y2
a
a
Converting from first-order to second-order
You can also convert from a system of coupled first-order equations of the form (17.2) to a second-order ODE
of the form (17.1). To do so, we will combine the two equations in such a way that it becomes an ODE of a
single variable (we choose y1 ) by making substitutions for y2 and its derivative where they appear.
80
CHAPTER 17. WEEK 8, HOMEWORK: SOLVING SECOND-ORDER ODES
81
Figure 17.1: A damped harmonic oscillator
Let’s take the derivative of the first equation (y1′ (t) = a11 y1 (t) + a12 y2 (t)) to give
y1′′ = a11 y1′ + a12 y2′
and then substitute in the right hand side of the second equation (y2′ (t) = a21 y1 (t) + a22 y2 (t)) for y2′
y1′′ = a11 y1′ + a12 (a21 y1 + a22 y2 )
Finally, we replace y2 with a function of y1 and y1′ by rearranging the first equation (y1′ (t) = a11 y1 (t) +
a12 y2 (t)) to solve for y2 and substituting it in:
y1′′ = a11 y1′ + a12 (a21 y1 +
a22 ′
(y − a11 y1 )),
a12 1
which on simplifying becomes
y1′′ − (a11 + a22 )y1′ + (a11 a22 − a12 a21 )y1 = 0.
Hopefully it is interesting to notice that the second-order ODE is determined by the trace and determinant
of the original matrix A!
Exercise 17.1
Practice converting between a second-order ODE and a system of first-order ODEs.
1. Convert the system y ′ (t) = 4y + 2z and z ′ (t) = 3y − z into a second-order differential
equation.
2. Convert y ′′ + 2y ′ − y = 0 with y(0) = 0 and y ′ (0) = −1 into a system of coupled first-order
differential equations with specified initial conditions.
17.2
Damped harmonic oscillator
In the previous assignment you were introduced to the damped harmonic oscillator, shown in Figure 17.1,
with spring constant k and damping coefficient b.
82
CHAPTER 17. WEEK 8, HOMEWORK: SOLVING SECOND-ORDER ODES
Exercise 17.2
For the damped harmonic oscillator in Figure 17.1:
1. Draw a free body diagram.
2. Show that the equation of motion for the system is: mr′′ (t) + br′ (t) + kr(t) = 0, where
r(t) = x(t) − xeq
3. Convert your 2nd order ODE above into a system of first order ODEs.
17.3
Solving second-order linear ODEs
17.3.1
Systems of 1st order ODEs
Remind yourself that you already know one way to do this. We solved systems of first order ODEs at the
end of Module 1, and you just learned how to convert 2nd-order ODEs to systems of first-order ODEs.
As a review, if we have a system of homogeneous first-order differential equations
y1′ (t) = a11 y1 (t) + a12 y2 (t)
where a11 , a12 , a21 , a22
matrix product,
y2′ (t) = a21 y1 (t) + a22 y2 (t)
y (t)
a
are real numbers, let y = 1
and A = 11
y2 (t)
a21
a12
, so we can write it as a
a22
y′ (t) = Ay(t).
We found that the general solution for this system of ODEs was:
(17.4)
y(t) = C1 eλ1 t v1 + C2 eλ2 t v2 .
where λ1 and λ2 are the eigenvalues of the A matrix and v1 and v2 are their respective eigenvectors.
17.3.2
Another Look: Guess and Check
Let’s try another way to find the solution to homogeneous second-order linear ODEs (17.5).
(17.5)
ay ′′ (t) + by ′ (t) + cy(t) = 0
Exponentials show up a lot in differential equations, because the function y(t) = e has the beautiful
property that it’s derivative y ′ (t) = λeλt is a multiple of the original. Let’s apply our guess and check
method and plug y(t) = eλt in to the differential equation that we’re trying to solve. Hopefully we can find
a value of λ that works.
If y(t) = eλt , then y ′ (t) = λeλt and y ′′ (t) = λ2 eλt . Plugging these into (17.5) we get
λt
aλ2 eλt + bλeλt + ceλt = 0
or after factoring
(aλ2 + bλ + c)eλt = 0.
Since eλt can’t be zero for all values of t, we conclude that the following characteristic equation must be
satisfied
aλ2 + bλ + c = 0
CHAPTER 17. WEEK 8, HOMEWORK: SOLVING SECOND-ORDER ODES
83
Let λ1 and λ2 denote the roots of this equation. Now, we bust out the quadratic formula and recall that
√
−b ± b2 − 4ac
λ1 , λ2 =
2a
Let’s assume that both λ1 and λ2 are real numbers, and λ1 ̸= λ2 . (If λ1 = λ2 or λ1 and λ2 are complex,
then the solutions are slightly different. We’ll deal with those later.) Then the general solution to the
differential equation is
y(t) = c1 eλ1 t + c2 eλ2 t .
This should look very familiar - it looks a lot like equation 17.4. λ1 and λ2 must be the eigenvalues of the
relevant matrix!
Exercise 17.3
Prove that λ1 and λ2 are the eigenvalues of the A matrix for a second order ODE
Exercise 17.4
Using the method outlined above, solve (by hand) the following problems:
1. y ′′ − 3y ′ − 10y = 0
2. y ′′ + 3y ′ + y = 0 with y(0) = 0, y ′ (0) = −1
Exercise 17.5
Check your solutions to the previous exercise using the applet here. You can set the values for a, b,
and c by moving the red sliders. Does the shape of the solution match what you expect?
Note that a, b, c correspond to m, b, k in our spring-mass system. Do your equations and answers
make sense for this system? How would you expect the system to behave? What happens if you
change the initial conditions for problem 2 (drag V0 and Y0 on the axis) e.g. what if Y0 is -1 and V0
is zero? If both are zero?
17.3.3
Complex Roots
We know from the quadratic formula that if b2 − 4ac < 0 then the roots are complex. What does this mean
for solutions to our second-order ODE (and system of first-order ODEs by extension)?
Let’s first introduce some notation for a complex root. Since there are actually two complex roots, that
come in a complex conjugate pair, let’s define
λ1 , λ2 = σ ± iω
where σ is the real part of the root, and ω is the imaginary part of the root. Although the root is now complex,
the exponential still satisfies the second-order ODE so the general solution is
y(t) = c1 e(σ+iω)t + c2 e(σ−iω)t
where c1 and c2 are now complex numbers such that c2 = c∗1 (the ∗ denotes the complex conjugate) in order
to generate a real solution. Let’s pause for a moment and think about this complex exponential.
CHAPTER 17. WEEK 8, HOMEWORK: SOLVING SECOND-ORDER ODES
17.3.4
84
Euler’s formula
The complex exponential can be decomposed using Euler’s formula into parts that involve trigonometric
functions. First, we note that
e(σ+iω)t = eσt eiωt
Now we use Euler’s formula to write
eiωt = cos(ωt) + i sin(ωt)
so that
e(σ+iω)t = eσt (cos(ωt) + i sin(ωt))
and by analogy
e(σ−iω)t = eσt (cos(ωt) − i sin(ωt))
This decomposition of the complex exponential implies that both eσt cos(ωt) and eσt sin(ωt) are solutions
to the original second-order ODE (go ahead, plug them in and check). The general solution can therefore be
written as
y(t) = Aeσt cos(ωt) + Beσt sin(ωt)
where A and B are real constants.
Exercise 17.6
1. Find the general solution of the second-order ODE
y ′′ + y = 0
2. Find the general solution of the second-order ODE
y ′′ + 2y ′ + 2y = 0
Exercise 17.7
Check your solutions to the previous exercise using the applet here. You can set the values for a, b,
and c by moving the red sliders. Does the shape of the solution match what you expect? What does
this mean physically for your spring-mass-damper system?
17.3.5
Repeated Roots
The final case we may see when solving a second-order linear ODE is when λ1 = λ2 = λ. This case is
important, because it represents the case of critical damping, which we will discuss in more detail in future
assignments. Critical damping is often optimal for system operation when smooth, non-oscillating return to
equilibrium is desired (e.g., for a shock absorber or door closer).
Exercise 17.8
1. Looking at the quadratic equation used to solve for λ1 and λ2 below, where a, b, c are the
coefficients of the 2nd order ODE, what condition must be satisfied for λ1 = λ2 = λ?
√
−b ± b2 − 4ac
λ1 , λ2 =
2a
CHAPTER 17. WEEK 8, HOMEWORK: SOLVING SECOND-ORDER ODES
85
2. Consider the equation of motion for the damped harmonic oscillator mr′′ (t) + bd r′ (t) +
ks r(t) = 0. (Note: we’re calling the spring coefficient ks and the damping coefficient bd here
to distinguish them from the root(s) of the characteristic equation, which we have been calling
λ, and the generic ODE coefficient b.) Solve for the critical damping coefficient, bc , which is the
value of bd corresponding to a characteristic equation with real, repeated roots (λ1 = λ2 = λ).
3. For the damped harmonic oscillator, find λ1 = λ2 = λ when bd = bc .
Previously, we showed that for the case of real roots and λ1 ̸= λ2 , the general solution to the differential
equation is a linear combination of two solutions:
y(t) = c1 eλ1 t + c2 eλ2 t
Unfortunately, when λ1 and λ2 are real and λ1 = λ2 = λ, the equation above no longer represents a
combination to two independent solutions, and no longer forms a general solution to the governing ODE.
Instead, for the case where λ1 = λ2 = λ, the general solution will be of the form:
y(t) = c1 eλt + c2 teλt
Why? Well, any solution to an ODE that is correct is valid, no matter how one arrives at that solution, so
you can plug yt and its derivatives back into our ODE (Eq. 17.1) and prove to yourself that it’s correct. For a
complete derivation of this general solution form (which also relies on some educated guessing to find the
form that works), you may optionally review this write-up from Paul’s Online Notes.
Exercise 17.9
1. Find the general solution of the second-order ODE
y ′′ + 2y ′ + y = 0
Exercise 17.10
Check your solution to the previous exercise using the applet here. You can set the values for a, b,
and c by moving the red sliders. Does the shape of the solution match what you expect? What does
this mean for your spring-mass-damper?
17.3.6
Damped harmonic oscillator
During the last few exercises, we’ve explored how a second order ODE behaves depending on the different
types of eigenvalues, both for general ODEs and for our spring-mass-damper system. The terms overdamped,
underdamped and critically damped refer to the behavior of the damped harmonic oscillator with these three
types of eigenvalues. In the overdamped case, the damping is sufficiently strong to remove any oscillatory
behavior, but the approach to equilibrium is slow. In the underdamped case, the damping is small enough
that the system still oscillates as it approaches equilibrium. The critically damped case smoothly and quickly
approaches equilibrium. We’ll explore these cases in more depth in the next chapter!
Chapter 18
Week 9, Class 1: Damped Oscillators,
Phase Planes and Non-homogeneous
2nd Order ODEs
Learning Objectives
• Explain the physical meaning of underdamped, overdamped, and critically damped.
• Consider damping plays into real world design considerations for spring-mass-damper systems.
• Connect the behaviour of a system’s solutions to the eigenvalues of the system.
• Draw a phase plane for a system of linear first-order differential equations and use it to
determine the behavior of the ODE.
• Understand the basic principles for solving non-homogeneous 2nd order ODEs.
Exercise 18.1
(Time goal: 15 min)
With your table, go through the solutions to the homework due today and identify a list of key
concepts. Identify which of these concepts you feel comfortable with and which are still confusing.
Try to resolve your confusions (about topics or specific problems) with the folks at your table and/or
make a plan to ask about them during the lecture.
18.1 Mini lecture: Damping, phase planes, and non-homogeneous
systems
18.2
More damped harmonic oscillators!
We’ve been working with spring-mass-damper systems. Recall that the equation of motion is
mr′′ (t) + br′ (t) + kr(t) = 0.
where r′′ (t) is the acceleration, r′ (t) is the velocity, and r(t) is the position. We derived this using Newton’s
second law, F = ma for the block with a simple spring with Fs = −kr(t) and linear damping Fd = −bv
86
CHAPTER 18. WEEK 9, CLASS 1: DAMPED OSCILLATORS, PHASE PLANES AND NON-HOMOGENEOUS 2ND ORDER ODES87
Figure 18.1: Damped harmonic oscillator.
As a reminder, we found a general solution for 2nd order ODEs either using the guess and check method
or converting to a system of first order ODEs. We found that the eigenvalues were
√
−b ± b2 − 4ac
λ1 , λ2 =
2a
and that they had the form
λ1 , λ2 = σ ± ωi
This led us to a general solution for a second order linear homogeneous ODE to be:
y(t) = Aeσt cos(ωt) + Beσt sin(ωt)
where σ is the real part of the eigenvalues and ω is the imaginary part.
18.2.1
Damping
As we saw in the last homework, the behavior of our system can be described in terms of its damping. An
over-damped system will not oscillate and will slowly approach equilibrium. An under-damped system will
oscillate as it approaches equilibrium. And a critically damped system will approach equilibrium as fast as
possible without oscillating.
Another way to think about these different types of damping is to imagine a door on a double hinge,
meaning the door can swing both ways.
• Over-damped: You swing the door open and let go; it slowly closes.
• Critically damped: You swing the door open and let go; it quickly closes.
• Under-damped: You swing the door open and let go; it rapidly swings back and forth past the door
frame a few times, then eventually stops moving.
CHAPTER 18. WEEK 9, CLASS 1: DAMPED OSCILLATORS, PHASE PLANES AND NON-HOMOGENEOUS 2ND ORDER ODES88
Figure 18.2: Examples of damped harmonic oscillators, image courtesy of past QEA students
Exercise 18.2
1. Convert the second-order differential equation (of motion) above into a system of two first-order
differential equations and find the eigenvalues in terms of the constants m, b and k.
2. Overdamped case: What must be true about m, b and k in order for the eigenvalues to be real
and distinct? What would a phase plane look like for this case?
3. Underdamped: What must be true about m, b and k in order for the eigenvalues to be complex?
What would a phase plane look like for this case?
4. Critically Damped: What must be true about m, b and k in order for there to be one repeated
eigenvalue? What would a phase plane look like for this case?
18.3
Damping in real life
Exercise 18.3
We’ve done two experiments so far with spring-mass-dampers. Were our systems underdamped,
critically damped or over damped?
Exercise 18.4
CHAPTER 18. WEEK 9, CLASS 1: DAMPED OSCILLATORS, PHASE PLANES AND NON-HOMOGENEOUS 2ND ORDER ODES89
Let’s say you were designing a bungee jumping system. Would you design it to be over-damped,
underdamped, or critically damped? Explain why. (There are a couple of ways you could decide to
answer this, we will take any reasonable, well-thought out answer).
Exercise 18.5
Some microphones translate pressure changes in the air into electrical signals via a membrane.
Should this membrane be designed to be over-damped, under-damped, or critically damped?
18.4
Nonhomogeneous Second-Order ODEs
So far in our second order ODEs, we’ve been dealing with homogeneous ODEs, i.e. equations that look like:
ay ′′ + by ′ + cy = 0
But in the real world, we often end up with equations that look like:
ay ′′ (t) + by ′ (t) + cy(t) = f (t)
Your phone (or some other mass) hanging vertically from a spring is one of these cases.
Exercise 18.6
1. Draw the FBD for your phone hanging from a spring. Use newtons law and your equations of
motion to derive a 2nd order ODE that describes the phone’s motion in the vertical axis.
2. Is there damping in this system? If so, where does it come from?
Our ODE for a hanging mass looks like
my ′′ (t) + by ′ (t) + ky(t) = mg
We might remember from first order ODEs that we can find the solution for a nonhomogeneous ODE by
adding a particular solution and the homogeneous solution. One particular solution for the hanging mass is
its equilibrium state, i.e. when y ′′ (t) = 0 and y ′ (t) = 0. We are left with:
y = mg/k
as our particular solution. We can then add this to our homogeneous solution to get a general solution for
our ODE.
Exercise 18.7
With your group, derive the general solution for your hanging mass in terms of m, k, and b.
Exercise 18.8
If you didn’t get to it last class (or if you want to try a better setup), try hanging your phone from
one of the provided springs and collect a dataset from the accelerometer. Does it look like what you
CHAPTER 18. WEEK 9, CLASS 1: DAMPED OSCILLATORS, PHASE PLANES AND NON-HOMOGENEOUS 2ND ORDER ODES90
might expect from your general solution? What information would you need (e.g. initial conditions,
etc) to find the particular solution for the position of your phone?
Exercise 18.9
Optional/Bonus What would a phase plane look like for a non-homogeneous ODE with f (t) equal
to some constant?
Chapter 19
Week 9, Class 2: Nonhomogeneous
ODEs
19.1
Forced harmonic Oscillators - Experiments
19.1.1
Nonhomogeneous Oscillators
In our last class, the hanging phone example ends up with your f (t) simply equal to a a constant, or mg.
my ′′ (t) + by ′ (t) + ky(t) = mg
From our first order ODEs, we (might) remember that we can find the general solution of a nonhomogeneous ODE by adding the solution to the homogeneous ODE and any particular solution of the
nonhomogeneous ODE. In other words,
y(t) = yp + yh
Where y is the general solution, yp is a particular solution and yh is the homogeneous solution. For our
hanging spring-mass-damper, the easiest particular solution is the equilibrium solution where y = mg/k.
Adding that to the homogeneous solution we get a general solution:
y(t) = Aeσt cos(ωt) + Beσt sin(ωt) + mg/k
One way to check if our equation makes sense is to plug in t = ∞; we should see that y(t) then
approaches the equilibrium solution of y = mg/k.
19.1.2
Forced Oscillation
In the last exercise and experiment, the position needs to be offset by its equilibrium value. However, we can
also capture much more complex behavior. What happens, for example, when we try to oscillate our system
with some force F = C sin(ωf t), where C is some constant amplitude and ωf some constant frequency (in
radians/s). Our ODE becomes
my ′′ (t) + by ′ (t) + ky(t) = mg + C sin(ωf t)
Exercise 19.1
This equation is much less intuitive to solve - as long as there is an oscillating force, we’ll never
really reach static equilibrium as in our prior example.
1. Given what you already know about oscillating systems, what might be a good guess for a
91
CHAPTER 19. WEEK 9, CLASS 2: NONHOMOGENEOUS ODES
92
particular solution for this ODE?
2. Add your guess to the homogeneous solution so that you have a guess for the behavior of the
system overall.
Exercise 19.2
Try to recreate the forced oscillations with your hanging phones. Hold the spring with your hand,
and then try to mimic a sine wave with your hand. We recommend trying two different frequencies:
• First try matching your frequency to that of the phone. What happens?
• Next try a frequency that does not match (Melinda found it was easiest to do this at a higher
frequency e.g. try to go at least twice as fast as the phone). What happens now?
• Take a look at your data. Does it match your expectations?
Note: Be careful with your phones! You may want the taller person in the group to do this or just
make sure to hold your phone nice and high so it doesn’t hit the ground.
You should have seen that when you match your forcing frequency to the natural frequency of the phone,
the amplitude of your oscillations becomes larger and larger. This is called resonance, and it occurs when the
frequency of the forcing function matches that natural frequency of your system. We’re not going to talk
about it much in class, but we think you should know that it exist.
Exercise 19.3
Resonance can be useful - e.g. when you are on a swing set, or when pushing someone on a swing,
you try to match your frequency to that of the system in order to go higher and higher. However,
it can also have catastrophic results. The Tacoma Narrows Bridge is one example, where the wind
was the force acting to make the bridge resonate. With your group, think of some other structures,
machines, and/or mechanisms where resonance might be useful and where it might cause issues.
Resonance aside, as long as our forcing frequency is not equal to the natural frequency, we end up with
a general solution that adds together sinusoidal waves at different frequencies. We’ve seen this before, e.g.
when we created a function to model the solar flux of the sun for a solar house. Here we can use the DFT
again to find the frequencies of our sine waves.
Exercise 19.4
Use your make_freq_plot.m function to take the DFT of your phone data from your second oscillating
experiment. What frequency peaks do you see? Are either of them the natural frequency or the
forcing frequency?
Exercise 19.5
BONUS QUESTION/EXPERIMENT (if time) A step function and/or square wave is another common
forcing function. Think about and sketch out with your group how you might expect the solution to
your ODE to look like in this case. You can try it out with your phone on a spring as well!
CHAPTER 19. WEEK 9, CLASS 2: NONHOMOGENEOUS ODES
Exercise 19.6
BONUS QUESTION/EXPERIMENTS (if time) Feel free to try any of the experiments that we did with
your phone hanging on a spring on the spring-mass carts. You should see similar behavior! (Note:
We found these were a little harder to see results for because of the higher degree of damping - this
was one reason we chose to put our phones in peril).
93
Chapter 20
Week 9 Homework
20.1
Fun: Dampers in Real Life
Some skyscrapers and bridges are designed with dampers that counteract vibration from wind, people, and
earthquakes. One of the most famous of these is the Taipei 101 tuned mass damper, which mainly reduces
sway due to wind. Unlike many other mass dampers, which are hidden features inside the building, this
one has been turned into a tourist attraction, complete with mascots called "Damper Babies". For more,
(optionally) listen to this excellent 99% Invisible episode: https://99percentinvisible.org/
episode/supertall-101/
Exercise 20.1
OPTIONAL. But fun!
Let the Damper Babies explain how the Taipei 101 damper works to you, in their own made-up
language. There are subtitles. https://youtu.be/gwsNyCBSgrM.
1. Why is the damper near the top of the building?
2. What type of damping (under-, critically or over-) is occurring here? Why?
20.2
Phase planes
To solve second order differential equations, we’ve been converting them to systems of first order ODEs. We
then have looked at how eigenvalues effect the behavior of our solutions to these systems. Phase planes are
a way to visualize the effect of different eigenvalues on your solutions.
In class, we talked about how to draw phase planes and how to build some intuition for what they look
like and tell you about a system. For your reference, we’ve included a few additional resources. This video is
a great walk through of how to draw phase planes. Many of the examples are pulled from Chapter 5.1-5.2 of
Steven Strogatz’s Nonlinear Dynamics and Chaos, which we also recommend. A scanned copy of that section
is available here.
While drawing phase planes by hand can help us to gain intuition, it can also be time consuming and
impractical. Luckily, there are lots of phase plane plotters online. Wolfram Alpha, for example, has a phase
plane widget.
Exercise 20.2
94
95
CHAPTER 20. WEEK 9 HOMEWORK
Based on the video linked in the text above and your earlier work, what shapes (e.g., circles, spirals,
and attractive points) would you expect to see in phase planes plotting position vs. velocity for real
spring-mass-damper systems with different types of eigenvalues? (Hint: shape/behavior will depend
on spring-mass-damper system eigenvalues. What possible eigenvalue combinations are there?)
Exercise 20.3
Graded problem B Solve the initial value problem
x′ (t) = x(t) + y(t)
y ′ (t) = 4x(t) − 2y(t)
subject to the initial conditions x(0) = 2 and y(0) = −3 using the eigenvalue/eigenvector method.
The next exercise will explore the geometric meaning of these eigenvalues and eigenvectors.
Exercise 20.4
Draw the phase plane, including the eigenvectors and any critical points for the system of ODEs in
Exercise 20.3. To gain a better understanding of phase planes, draw it by hand. Then check using the
pplane Java software linked to above.
20.2.1
A Deeper Look
Phase planes are very similar to slope fields: They are a graphical representation of all the possible solutions
to a differential equation. The solutions are curves which follow the arrows.
The key to phase planes are eigenvalues. The phase plane for a linear system
x′ (t) = ax(t) + by(t)
y ′ (t) = cx(t) + dy(t)
is entirely described by the eigenvalues and eigenvectors of the matrix
a b
.
c d
The overall “shape” of the phase plane is determined by the eigenvalues (which we’ll call λ1 and λ2 ) and
eigenvectors (which we’ll call v1 and v2 ) of that matrix. In particular, it will make a big difference whether
the eigenvalues are (1) distinct and real, (2) complex, or (3) the same, i.e., repeated. In the sections below, we
will explore these different cases. Don’t stress about memorizing all these cases—just focus on the intuition
and later, we’ll connect it to a physical oscillator.
20.2.2
Case 1: distinct, real eigenvalues
In Module 1, you learned that the solution to the system of first-order ODEs is
y(t) = C1 eλ1 t v1 + C2 eλ2 t v2 ,
when the eigenvalues are distinct. Instead of focusing on this precise algebraic expression for the solutions,
we’ll look at the phase plane, which gives us broad geometric information about the solutions.
There are three different cases that produce qualitatively different phase planes (and, thus, qualitatively
different solutions): both eigenvalues are positive, both eigenvalues are negative, or one eigenvalue in
positive and one is negative.
96
CHAPTER 20. WEEK 9 HOMEWORK
Exercise 20.5
Fill in the missing information. You may want to use the function eig() in Matlab.
Equation
Phase Plane
Eigenvalues
x′ = 2x + y
Terminology
Unstable
y ′ = x + 2y.
Both Negative
x′ = −5x + y
λ1 = −1
y ′ = 4x − 2y.
λ2 = −6
x′ = x + y
Saddle
′
y = 4x − 2y
20.2.3
Case 2: complex eigenvalues
When the eigenvectors are distinct, the solution is
y(t) = C1 eλ1 t v1 + C2 eλ2 t v2 .
This is true whether the eigenvalues are real or complex. But, if the eigenvalues are complex, then the
eigenvectors v1 , v2 and the constants C1 , C2 are also complex.
The eigenvalues will always be complex conjugates, i.e., λ1 = α + iω and λ2 = α − iω for some real
valued α and ω. Using Euler’s identity, we can write
eλ1 t = e(α+iω)t = eαt (cos(ωt) + i sin(ωt)).
Here’s why that’s helpful: sines and cosines rotate around the origin and the coefficient eαt controls the
magnitude of that rotation. But that coefficient eαt is changing in time, depending on the value of α.
97
CHAPTER 20. WEEK 9 HOMEWORK
Exercise 20.6
The three systems below represent one example of each of the following cases: α > 0, α = 0 and
α < 0. For each example (1) find the eigenvalues (e.g. using MATLAB) determine which of the three
cases it is. We’ve provided the plots for you here - you can test your intuition by guessing which
is which before you plot them yourself (using Wolphram Alpha or another online plotter). Which
plot(s) will reach equilibrium?
1. x′ = −x + 2y and y ′ = −x − 3y
2. x′ = 6x − 13y and y ′ = x
3. x′ = y and y ′ = −4x
Exercise 20.7
Graded Problem C The phase planes in Figures 20.1 and 20.2 represent spring-mass-damper systems.
Briefly explain your answers to the following questions.
1. What sign of α would each phase plane have? What term would you use to describe the
behavior of each plane?
2. What is the physical difference between these two systems?
If you’d like to play around with these phase planes, the inputs are:
x′ = y
y′ =
−k
c
x− y
m
m
k = 1, m = 5, and c is for you to figure out
98
CHAPTER 20. WEEK 9 HOMEWORK
Note that you can either place the constants directly into the equation or use the parameter expressions section of the pplane control panel.
Figure 20.1
99
CHAPTER 20. WEEK 9 HOMEWORK
Figure 20.2
20.2.4
Case 3: one repeated eigenvalue
If the eigenvalues are the same, i.e., λ1 = λ2 , then we have to look at the eigenvectors v1 , v2 . There are
two cases: (1) the eigenvectors are linearly independent, or (2) the eigenvectors are a scalar multiple of each
other, i.e., v1 = kv2 for some constant k.
Exercise 20.8
Let’s look the first case.
1. Here’s a system with one positive eigenvalue and two linearly independent eigenvectors:
x′ = 2x and y ′ = 2y.
2. Here’s a system with one negative eigenvalue and two linearly independent eigenvectors:
x′ = −2x and y ′ = −2y.
100
CHAPTER 20. WEEK 9 HOMEWORK
Plot both systems using Wolfram alpha (or another online plotter).
Exercise 20.9
Let’s look at the second case.
1. Here’s a system with one positive eigenvalue and only one eigenvector:
x′ = 7x + y and y ′ = −4x + 3y.
Plot the system using Wolfram alpha (or another online plotter). Try to find the (one) eigenvector graphically.
2. Suppose you had a system with one negative eigenvalue and only one eigenvector. What do
you think the solutions would look like? Is this related to a physical system?
20.3
Nonhomogeneous Second Order ODEs
We started working with some nonhomogeneous second order ODEs in class with our hanging phone
experiments.
You can get another perspective on nonhomogeneous systems by reading over (or at least skimming)
section 4.3 "The Forced Harmonic Oscillator" in Kurt Bryan’s book Differential Equations here.
Exercise 20.10
Let’s go back to our basic hanging phone equation (no oscillations). Our ODE was mx′′ + bx′ + kx =
mg We’d like to derive a theoretical solution, and compare it to our results from class.
1. Based on your reading and/or the work you did in class, what is the general solution for the
position of the phone?
2. What are some possible values of b given what you know about the damping?
3. Use your initial values to solve for a particular solution.
Exercise 20.11
Optional Challenge Problem
This problem will not be graded so if your results look weird, no need to fret - we encourage you
to try it out! There are several levels of challenge within the problem. The "easy" option should be
doable and not take much time. The other two are more time consuming.
Let’s finally try to compare our experimental results to our theoretical ones. This is not as trivial as
it seems!
• Easy option: Eliminate damping from your theoretical equation. Take some derivatives of your
(now much simpler) solution to find the theoretical acceleration. Plot that against your actual
measured acceleration values.
• Do the same thing as above, but now with damping! Try to find a damping coefficient that fits
CHAPTER 20. WEEK 9 HOMEWORK
your data.
• Use Euler’s method to take the numerical integrals of your acceleration data and find your
measured position and velocity. Plot this and compare with your theoretical results. (Note: We
noticed significant drift.)
101
Chapter 21
Optional Extension Chapter:
Pendulums - Second-Order ODEs and
Rotating Reference Frames
THIS IS AN OPTIONAL EXTENSION CHAPTER. If you’re bored or just want to learn more in QEA3, this chapter
is designed to be worked through at your own pace. It is completely optional and has no particular due date. You
can work through it this week, in three weeks, or never.
So far we have studied the solution to second order linear differential equations through the example
of spring-mass-damper systems. The solutions to these types of systems are oscillatory, and that the
introduction of damping leads to a decaying oscillation amplitude.
21.1
Rotating Oscillatory Systems: The Pendulum
The spring-mass-damper system is an excellent example of oscillatory motion using fixed Cartesian coordinate
system. However, sometimes it is more practical to use a rotating reference frame. In this section, we will
look at the simple pendulum, shown in Figure 21.1, which demonstrates the utility of analysis using a rotating
reference frame. The pendulum rotates about a frictionless pivot at point O, and the mass m is connected by
a pin joint to a weightless rod of length l which is connected to the pivot.
21.1.1
Pendulum Reference Frames
Like many systems, the simple pendulum can be analyzed using multiple reference frame choices, but
the complexity of the analysis will vary significantly. One option for the pendulum is to use a Cartesian
coordinate system with the origin located at the pivot point, as seen in Figure 21.1. In this coordinate system,
the position of the mass can be given as ⃗r = xî + y ĵ, subject to the constraint equation x2 + y 2 = l2 .
102
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES103
Figure 21.1: Cartesian coordinate system for the simple pendulum.
Using the pendulum position, ⃗r, we can also find the pendulum velocity and acceleration as,
⃗v =
d⃗r
= ẋî + ẏ ĵ
dt
(21.1)
⃗a =
d⃗v
= ẍî + ÿ ĵ
dt
(21.2)
Exercise 21.1
1. Draw an FBD for the simple pendulum, using the mass as the system. Include the Cartesian
coordinate system in your diagram. It may be helpful to draw multiple frames (with x<0, x=0,
x>0) to help understand the direction (sign) of forces.
2. Show that the two governing equations for the simple pendulum in Cartesian coordinates are:
ẍ +
T
x=0
ml
T
y = −g
ml
where T is the tension force in the rod (positive when the rod is in tension).
ÿ +
3. Confirm that the equations above hold when the pendulum is in static equilibrium (Hint:
Think about the conditions for x,y,ẍ, and ÿ when the pendulum is hanging straight down).
Using Cartesian coordinates, we end up with a system of three equations (below) and three unknowns
(x, y, T ). While solving this system is possible, the coupled equations make analysis of the system characteristics challenging. Instead, we will take the approach of analyzing the simple pendulum using a rotating
reference frame.
T
x=0
ml
T
ÿ +
y = −g
ml
x2 + y 2 = l 2
ẍ +
(21.3)
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES104
21.1.2
Rotating Frame for the Pendulum
Instead of analyzing the simple pendulum using a Cartesian coordinate system fixed at the origin, we will
introduce a rotating coordinate system [r̂, θ̂] aligned with the pendulum rod, as shown in Figure 21.2. If you
want to refresh your memory on rotating reference frames, consider checking out this chapter.
Figure 21.2: A simple pendulum with a rotating reference frame aligned with the rod. k̂ points out of the
page.
21.1.3
Relationship Between Fixed and Rotating Frames
It is often useful to express, or transform, one reference frame in terms of another. Let’s think this through
using a set of unit vectors r̂ and θ̂ attached to the pendulum rod. These unit vectors will be rotating.
For simplicity let’s assume that these unit vectors are initially aligned with the pendulum hanging at its
equilibrium position (θ = 0). In this state, the r̂ vector is aligned with −ȷ̂, and θ̂ is aligned with ı̂. If we
rotate the pendulum counterclockwise through an angle of θ, as shown in Figure ?? then:
r̂
=
sin(θ)ı̂ − cos(θ)ȷ̂
θ̂
=
cos(θ)ı̂ + sin(θ)ȷ̂
Exercise 21.2
Similar to the relationship given above, please write the fixed global unit vectors ı̂ and ȷ̂ as a function
of θ in terms of the rotating unit vectors r̂ and θ̂.
21.2
Rotating Reference Frames: Mathematical Background
One of the most important takeaways from this section will be that knowing the reference frame you are
taking time derivatives in really matters! In particular, when taking time derivatives in a fixed reference
frame we consider the unit vectors (e.g. ı̂, ȷ̂, k̂) to be constant. This can be seen when finding the velocity
(Equation 21.1) and acceleration (Equation 21.2) of the pendulum mass in the fixed Cartesian coordinate
system. This assumption of constant unit vectors is not the case when the reference frame is rotating.
For example, consider any vector function f (t) defined with respect to the Pendulum (in other words,
using r̂, θ̂):
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES105
f (t) = fr r̂ + fθ θ̂
By the product rule, the derivative of this function with respect to the global reference frame (denoted by
|G ) is then:
df
dfr
dr̂ dfθ
dθ̂
|G =
r̂ + fr
+
θ̂ + fθ
(21.4)
dt
dt
dt
dt
dt
Time Derivative of a Unit Vector
Now, at this point we need to remind ourselves of the relationship between the time derivatives of the unit
vectors, and the angular velocity ω = θ̇k̂. Let’s think this through a little using a set of unit vectors r̂ and θ̂
attached to the pendulum in Figure ?? and equation 21.4.
Let’s compute the rate of change of the unit vectors attached to the pendulum (For a nice video walking
through this derivation, go here. (In the video, note that the definition of r̂ and θ̂ are different by a rotation
of π/2).
Let’s look at r̂ first:
dr̂
dt
dr̂
dt
=
d
(sin(θ)ı̂ − cos(θ)ȷ̂)
dt
=
cos(θ)θ̇ı̂ + sin(θ)θ̇ȷ̂
dr̂
dt
⇒
=
θ̇θ̂
(21.5)
Now let’s look at θ̂
dθ̂
dt
dθ̂
dt
=
d
(cos(θ)ı̂ + sin(θ)ȷ̂)
dt
=
− sin(θ)θ̇ı̂ + cos(θ)θ̇ȷ̂
⇒
dθ̂
dt
=
−θ̇r̂
(21.6)
These results can be unified if we use the angular velocity ω = θ̇k̂ and write,
dr̂
dt
dθ̂
dt
Definition of Angular Velocity
velocity since
=
ω × r̂
(21.7)
=
ω × θ̂
(21.8)
Alternatively, we could use the rotating unit vectors to define the angular
ω
ω
dr̂
dt
dθ̂
= θ̂ ×
dt
= r̂ ×
Exercise 21.3
(21.9)
(21.10)
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES106
Figure 21.3: Simple pendulum FBD with rotating reference frame.
dθ̂
Verify that dr̂
dt = θ̇ θ̂ and dt = −θ̇r̂ using the angular velocity ω = θ̇ k̂ and equations 21.7 and 21.8
above. Remember that you can use the right hand rule (RHR) to help determine the direction of cross
products!
The Vector Derivative Transport Theorem
Taking the above result for the time derivative of a unit vector, we can express the derivative of the function
f (t), given by equation 21.4, as:
df
dfr
dfθ
θ̂ + ω × (fr r̂ + fθ θ̂)
|G =
r̂ +
dt
dt
dt
(21.11)
or more simply
df
df
|G =
|P + ω × f
dt
dt
where G refers to the global frame and P refers to the Pendulum frame.
(21.12)
Exercise 21.4
In the rotating reference frame, the position of the mass can be written as ⃗r = lr̂. Using this position
vector and the equations above:
1. Find ⃗v for the mass using equation 21.4.
2. Find ⃗v for the mass using equation 21.12 and compare to your result above.
3. Show that ⃗a = lθ̈θ̂ − lθ̇2 r̂.
21.3
Equation of Motion with Rotating Frame
Now that we have found the acceleration of the pendulum mass in the rotating reference frame, we can
apply Newton’s second law to find the equation of motion for the system. To start, we will need the free
body diagram in Figure 21.3.
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES107
Exercise 21.5
Using Newton’s second law and the definition of ȷ̂, show that the two governing equations for the
simple pendulum are:
g
θ̈ + sin(θ) = 0
l
T = mlθ̇2 + mg cos θ
21.4
Review: the Transport Theorem
We have developed the following expression for the relationship between the derivative of a vector function
in the inertial frame to that in the rotating frame.
df
df
|G =
|r + ω × f
dt
dt
where G refers to the inertial frame and r refers to the rotating frame (we have been referring to this as the
pendulum frame, but this applies in general). This derivative plays a key role in understanding the velocity
and acceleration of a moving body in a rotating reference frame, and is generally known as The Transport
Theorem.
21.5
Pendulum Revisited
In the previous assignment, you analyzed the simple pendulum in Figure 21.4, and arrived at the two
governing equations below:
g
sin(θ) = 0
l
T = mlθ̇2 + mg cos θ
θ̈ +
(21.13)
(21.14)
Looking at equation 21.13, we notice that the equation is nonlinear because of the sin(θ) term. The
presence of this nonlinear term means we cannot directly use the solution techniques we have practiced for
second order linear ordinary differential equations. Instead, we need to linearize the governing differential
equation before finding the solution.
21.6
Linearization
Many models of real world phenomena are nonlinear in nature, but most of our analysis techniques, e.g.
eigenvalues and eigenvectors, Laplace transforms, etc. are based on linear models. However, the behavior
of a nonlinear system close to an operating point can often be well modelled by the behavior of a linear
approximation under certain conditions which are often met in practice. Here, we will go over the concept
of linearization of single-variable functions.
21.6.1
Linear approximation to a function of a single variable
In your previous mathematics classes, you may have encountered the concept of a Taylor series. A Taylor
series is an infinite polynomial series representation of a function of a single variable expanded about a
given point. Here, we are going to provide a brief synopsis of some of the key points.
• A function of a single variable, f (x), can be represented as a Taylor series about a point x = a
f (x) = f (a) + f ′ (a)(x − a) +
f ′′ (a)
f ′′′ (a)
(x − a)2 +
(x − a)3 + . . .
2!
3!
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES108
We will refer to the point x = a as the operating point. If the operating point is x = 0 the Taylor
series is known as the Maclaurin series.
• The Taylor series converges under certain assumptions about the function. Most of the time it
converges to the function f (x), but not always. A complete treatment of this subject requires ideas
from complex analysis and will not be presented here.
• Truncating the Taylor series (cutting off the series at some point) results in a polynomial approximation
to the function in the vicinity of the operating point. These polynomials are known as the Taylor
polynomials.
• The first few Taylor polynomials are
T0 (x)
=
f (a)
T1 (x)
=
f (a) + f ′ (a)(x − a)
T2 (x)
=
f (a) + f ′ (a)(x − a) +
f ′′ (a)
(x − a)2
2!
and they are referred to as the zero-order, first-order, and second-order Taylor polynomials respectively.
The zero-order polynomial matches the value of the function at the operating point only. The firstorder polynomial matches the value of the function and its derivative at the operating point, while the
second-order polynomial matches the second derivative too. The first-order polynomial is a linear
approximation to the function because its graph is a straight line.
• The error associated with an nth-degree Taylor polynomial is roughly
Rn (x) =
f n+1 (ξ)
(x − a)n+1
(n + 1)!
where ξ is a number between x and a. We use the notation Rn (x) because the error is often known as
the remainder. This is one of the possible ways of writing the error and it emphasizes the fact that the
error in an nth-degree Taylor polynomial grows as (x − a)n+1 and depends on the (n + 1) derivative
of the function being approximated. In most cases the error will be small when close to the operating
point and grow as you move further away from it.
Exercise 21.6
Calculate the first three non-zero terms of the Taylor series for each of the following functions about
the operating point x = 0. In each case, write down the first-order Taylor polynomial (if one exists).
You can check your work with the Series function in Wolfram Alpha (or a similar program of your
choice).
1. ex
2. sin(x)
3. cos(x)
4. ln(1 + x)
21.6.2
All the world’s a spring...
It is often said that ‘the whole world is a spring’ near an equilibrium point. Let’s consider this statement in
view of what we just learned about Taylor series and linearization.
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES109
Let’s consider the equation of motion for a system. We don’t know a lot about this system except that
there is a single force acting on the system which is a nonlinear function of position F (x) and that the
system has a stable equilibrium at position x0 .
Exercise 21.7
1. Knowing that the system has a stable equilibrium at position x0 , what can you say about the
force at this position F (x0 )?
2. Knowing that the system has a stable equilibrium at the position x0 , what can you say about
the DERIVATIVE of the force with respect to position evaluated at the position x0 ? Sketch
what the force function has to look like near the equilibrium position...what is true about the
slope of this function?). Let’s use the variable k to denote the magnitude of the slope of the
force at x0 (and because this matches our spring systems which have a stable equilibrium).
3. To use the tools that we have learned for solving linear equations of motion, we want to
linearize this equation for the force F (x) about the position x0 . Write down the Taylor series
linear approximation for the unknown function F (x) near x0 . (Hints: How many terms in
the linear approximation? And it’s OK to include F and its derivative(s) evaluated at certain
points.)
21.7
Solution to Linearized Pendulum Governing ODE
Now that we have some background in linearization, we can find the solution for the pendulum’s linearized
equation of motion.
Exercise 21.8
For the pendulum equation of motion in equation 21.13:
1. What angle θ should the equation be linearized about? Why?
2. Linearize equation 21.13 about the point you identified.
3. For approximately what range of angles is the linearization valid?
Now that we have the linearized form of the equation of motion, we can solve for the trajectory of the
pendulum for small displacements.
Exercise 21.9
1. Assuming a solution of the form θ(t) = eλt , show that the characteristic equation of the
linearized equation of motion, θ̈ + gl θ = 0, has two complex roots that are a conjugate pair of
p
the form λ = ± − gl .
2. Based on what you have found for λ, what is the frequency of oscillation (i.e., how many times
it cycles per second) of the pendulum?
3. Based on what you have found for λ, will the solution to the governing ODE decay with time?
Why or why not?
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES110
4. If the pendulum starts at rest withp
an initial angle θ(0) = θ◦ , show that the solution for the
pendulum motion is θ(t) = θ◦ cos( gl t). (Hint: Look back earlier in the book for the general
solution for a 2nd order ODE with a characteristic equation with complex roots)
21.8
The Damped Pendulum
In real life, the amplitude of the pendulum oscillation would decrease with time due to the impact of
aerodynamic drag. To model this, we could add a damping term to our pendulum model. A common model
for aerodynamic drag is F⃗D = − 12 ρCD v 2 Av̂ where CD is the drag coefficient and A is the cross sectional
area. Because this model is nonlinear, it would add increased difficulty to the pendulum model. Instead, we
could consider using a linear model of drag F⃗D = −b⃗v = −blθ̇θ̂ under the assumption that the pendulum
velocity is small for small oscillation angles. With this linear drag model, the equation of motion would
b
become θ̈ + m
θ̇ + gl θ = 0, which is of the same form as the spring-mass-damper.
21.9
Pendulum Experiment
Exercise 21.10
Once again, you can put your phones into [limited] peril for the sake of science! Using your phone
as the mass, collect accelerometer data for a simple pendulum. Make sure to measure your constants
(i.e. the length of string for your pendulum, the mass of your phone).
CHAPTER 21. OPTIONAL EXTENSION CHAPTER: PENDULUMS - SECOND-ORDER ODES AND ROTATING REFERENCE FRAMES111
Figure 21.4: A simple pendulum.
Chapter 22
Week 10, Class 1: Return of Spectral
Analysis and the Fourier Transform
Learning Objectives
This week:
• Describe complex numbers as both complex exponentials and sums of real and imaginary
components, and be able to convert between the two forms.
• Generate an N-point DFT matrix by hand and using Matlab.
• Use the DFT to convert a signal from the time domain to the frequency domain by doing a
single matrix-vector multiply.
• Identify the minimum sampling frequency necessary to ensure that no information is lost
when sampling a continuous-time signal to generate a discrete-time signal.
In the next couple weeks, we are going to focus in on spectral analysis, where instead of looking at a
signal in the time domain, we will look at the frequency components which make up the signal. Identifying
the primary frequencies that make up a signal (e.g., measurements from an accelerometer) can provide
valuable insights into the behaviour of the underlying system. This week we will discover the math behind
the discrete Fourier transform (DFT), a powerful mathematical tool that uses complex numbers, bases, and
projections to analyze the frequencies present in a signal.
22.1
Lecture: Complex numbers [15 min]
22.2
HW review [15-20 min]
22.3
Review of Complex Numbers
√
We can define a complex number z = x + jy, where j = −1 (sometimes called i, this is the imaginary
number). x is referred to as the real part of this number and y is the imaginary part.
• If we think of a two dimensional Cartesian plane with the x axis as the real axis and the y axis as the
imaginary axis, then the complex number z = x + jy is a point in this plane. This is referred to as the
complex plane.
• The magnitude of the complex number is the magnitude of the vector to this position on the plane:
112
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM113
this magnitude (or amplitude) is given by
A = |x + jy| =
p
x2 + y 2
note we can also think of this as the “radius” of the complex number in a polar coordinate system.
• The angle that this vector makes with the real axis is
θ = tan−1
y
x
this is often called the phase angle.
There is a useful equation in complex numbers called the Euler-de Moivre equation (which, if you
care to try it out, is easily provable from the Taylor series expansions of sin(θ), cos(θ) and eθ ). This formula
should look somewhat familiar - you used it recently to solve second order ODEs:
ejθ = cos(θ) + j sin(θ)
(22.1)
If you compare this to the expression z = x + jy with x identified as cos(θ) and y identified as sin(θ)
you can see that we can express any complex number z in terms of its magnitude and phase angle as a
complex exponential
z = x + jy = Aejθ .
The complex conjugate of z = x + jy is defined as z ∗ = x − jy.
Since
y
y
tan−1 −
= − tan−1
x
x
(22.2)
(22.3)
the conjugate of Aejθ is Ae−jθ . So, put simply, for the complex conjugate, replace j with −j everywhere
it occurs.
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM114
Exercise 22.1
The following exercises are to help you get an understanding of some properties of complex numbers
which will be useful in the subsequent development.
1. Simplify and write the following numbers in the form of a + jb.
(a) Aejθ · Bejϕ
(b) |ejθ |
(c) ejπ
(d) ej2π
2. Show
z = x + jy or z = Aejθ is given
√ that the amplitude or magnitude of a complex number
∗
∗
by zz (square root of z times its complex conjugate z ).
The Euler-de Moivre equation defines a clear mathematical relationship between the sine and cosine
functions and the complex exponential function. We often think of the sine and cosine functions in terms of
waves or oscillations at a particular frequency. A complex exponential of the form ejωt can also be viewed as
representing an oscillation, where ω would be the frequency of this complex exponential. Since this complex
exponential has an angle of ωt, if ω > 0, ejωt spins counter clockwise when plotted on the complex plane.
It spins at a rate of ω radians per unit time. If you plot the complex value ejωt on the complex plane, you
will get Figure 22.1. The real part of this number equals cos(ωt) and the imaginary part has a magnitude of
sin(ωt).
1
Figure 22.1: Complex exponential on the complex plane.
For a positive ω, as time t increases, the complex exponential as depicted in Figure 22.1 spins around
the unit circle counter clockwise, covering ω radians per unit time. ω here is the angular frequency of the
complex exponential ejωt . The frequency in Hertz (Hz), is the number of times the complex exponential
goes around the unit circle per second (t is in units of seconds). Hence, if the angular frequency is ω radians
ω
per second, the frequency in units of Hz is 2π
Hz. For negative frequencies (ω < 0), the complex exponential
spins clockwise as t increases. We can represent a phase shift θ of the complex exponential easily as ejωt+jθ .
Exercise 22.2
Consider a complex exponential representing an oscillation of a mass on a spring. The amplitude of
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM115
oscillation is 5 cm, the frequency of oscillation is 0.3 Hz and the phase shift is 30 degrees.
1. Write the mathematical expression for this complex exponential in terms of time t in seconds.
(Be careful! We have purposely not given things in consistent units here!)
2. Draw a figure of this complex exponential as a vector in the complex plane for time t = 1
second. Make sure to label all parts of this figure including giving an quantitative indication of
both the magnitude and angle of the vector.
3. Coming back to the real world, use the magnitude and angle from the previous part to compute
the position of the mass (relative to the equilibrium position) at time t = 1 second.
Additional Resources for Complex Numbers
complex numbers:
You may find it useful to review the following videos on
• Introduction to Complex Numbers
• Dave Academy: complex exponentials part 1. (uses i =
√
−1).
• Dave Academy: complex exponentials part 2. .
22.4
Introduction to the DFT
In this section, we shall mathematically dig into tools to analyze the frequency content of signals. In
particular, we will work with the discrete Fourier transform (DFT), which is an operation that takes a
finite-length discrete-time signal and decomposes it into its constituent frequency components.
The DFT involves a change of basis similar to working with eigenfaces. The general strategy we are
going to use is to project an N -sample-long discrete time (DT) signal1 , represented as a vector, onto
a basis set of orthonormal vectors which are vector representations of N -sample-long, discretized
complex exponential functions. These projections will thus tell us “how much” of each complex
exponential (and hence frequency) is present in the signal, a process illustrated in Figure 22.2. This
is analogous to projecting vectorized pictures of faces onto the eigenfaces, which were a set of
orthonormal vectors which formed a basis of the “face space”.
Note: In this class, we will be working primarily with the discrete Fourier transform. If you are interested
in more detail of the continuous versions, check out Khan Academy on Fourier Series, Wolfram MathWorld
on Fourier Series and Wolfram MathWorld on Fourier Transform.
Helpful videos/links
– Overview of the discrete Fourier transform (DFT)
– Harvey-Mudd intro to DFT in matrix-vector form (note that their definition of W differs from
ours by a Hermitian transpose).
22.5
Review of Bases and Projections
You have seen the concept of projecting onto a set of basis vectors many times throughout QEA. In the
context of the Fourier transform, our basis vectors will be a set of discretized complex exponentials.
1 For information on how a continuous signal would be sampled into a discrete time signal, see Section 22.7; the short version is that
you sample the signal by recording the value of the signal at regularly-spaced intervals that occur with a sampling frequency Fs (in Hz).
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM116
Figure 22.2: The discrete Fourier transform tells us "how much" of a frequency is present in a discrete time
signal.
Before we dive into the details of the Fourier Transform, we will review this key concept of projection
onto a new basis.
Please discuss the following key points at your table and try to make sense of them together.
Assuming we have n real column vectors vi , each of which are n-dimensional:
– This set of vectors is orthonormal if viT vj = 0 for i ̸= j, and viT vi = 1.
– Any vector x in n dimensions can be represented as a linear combination of these orthonormal
vectors:
x=
n
X
ai vi
(22.4)
i=1
where ai are the weights or coefficients.
– The weights are simply given by
ai = viT x
(22.5)
the projection of x onto the set of vi vectors.
– All of the weights can be computed simultaneously (in a matrix of weight vectors a) using a
transformation matrix W
a = Wx
(22.6)
W = [v1 v2 . . . vn ]T
(22.7)
where
is an orthogonal matrix (a.k.a. orthonormal matrix).
– The weights a represent the vector x in the new basis.
– The inverse of a real orthogonal matrix is its transpose, so W−1 = WT . This can be used to
map from weights a in v-space back to vector x.
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM117
Exercise 22.3
Consider the following basis vectors with real entries in 2-dimensions,
!
v1
v2
=
√1
2
√1
2
=
√1
2
− √12
,
!
1. Confirm that these basis vectors form an orthonormal set.
2. Write down the orthonormal transformation matrix W.
2
3. Express x =
as a linear combination of v1 and v2 by using the transformation
3
matrix to determine the weights.
4. Use the
of the transformation matrix to determine the vector x given the weights
inverse
3
a=
.
−4
Review Resources for Bases and Projections
If the key points and review exercise above were unfamiliar or you would like to brush up on these
concepts, the teaching team recommends the following resources on orthogonal projections:
– Orthogonal projections pt. 1
– Orthogonal projections pt. 2.
– Material from QEA1 on basis and projections is in Module 1 - Faces Day 3: Linear Independence,
Span, Basis, and Decomposition. (Note: Assignment names in QEA1 may have changed!)
22.6
Complex Exponentials as a Basis
The basis for the DFT is composed of N complex vectors vi where the index i ranges from 0 to N − 1
and where N is a number you choose.

i
ej2π N ·0
i
ej2π N ·1
i
ej2π N ·2
..
.











1 

vi = √ 


i
N
·n
j2π
 e N



..




.
i
ej2π N ·N −1
(22.8)
where n = 0,1,2,....N − 1 is the index of the discretized time interval. Note that the ith vector (vi )
contains N samples of a complex exponential of angular frequency 2πi
N radians per sample; you can
also think of the ith vector as a complex exponential that completes i cycles during the sampling
period.
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM118
Exercise 22.4
A key insight from Section 22.6 is that the ith vector (vi ) can be thought of as a complex
exponential that completes i cycles during the sample period. This is important because it shows
the relationship between N and the angular frequencies available in the discrete Fourier
transform.
1. Choose N = 10 for a set of complex vectors vi , defined by Equation 22.8. What is the
size of the matrix v which has columns vi ?
2. Create the matrix v for N = 10 using the code below. Make sure you understand how
the code relates to Equation 22.8.
N = 10;
for k = 0:N-1
v(:,k+1) = (1/sqrt(N))*exp(i*2*pi*k*[0:N-1]/N);
end
3. Plot the real part of the 1st column of v using stem(real(v(:,1))). What angular
frequency, in radians per sample, does this column correspond to?
4. Plot the real part and the imaginary part of the 2nd column of v on the same axes (it
might be clearer to just use plot() and hold on in this case). How does what you see
relate to the Euler-de Moivre equation? What angular frequency, in radians per sample,
does this column correspond to? How many cycles occur during the sampling period?
5. Increase N to N = 30. Plot the real part of column 4 and column 28 on the same
axes using stem() or plot(). What are the angular frequencies of these two vectors?
How does what you see relate to the concept of aliasing we discussed in the previous
assignment?
We saw earlier that an orthonormal set is a set of vectors for which:
(
1
viT vk =
0
i=k
i ̸= k
(22.9)
i=k
i ̸= k
(22.10)
For complex vectors this changes slightly to:
(
viH vk
=
1
0
where the subscript H indicates the conjugate transpose, also known as the Hermitian transpose. The
conjugate transpose of a vector or a matrix is the transpose of the vector or matrix, with each entry
replaced by its complex conjugate. In MATLAB, you can still use the apostrophe (’) to do the Hermitian
transpose.
The basis vectors for DFT (Equation 22.8) constitute an orthonormal set. If you’re curious, the proof of
this can be viewed at this link: Proof of orthonormalcy for DFT basis.
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM119
Exercise 22.5
1. (If you have time:) For N = 10, demonstrate orthonormalcy for a subset of the DFT
vectors: show two cases of i = k and two of i ̸= k. (Hint: You can do this in Matlab
using the vectors you defined in the previous exercise. Include code and results in your
submission).
22.7
Optional reading: Sampling a Continuous Time Signal
Most real signals are continuous functions of time, e.g., a signal x(t) may be the acceleration in a
certain direction of your phone as a function of time t, or an audio signal of voltages sent to a speaker
as a function of time. Such signals are called continuous-time (CT) signals. When processing such a
signal on a computer, it needs to be sampled to create a discrete-time (DT) signal, since computers do
not have infinite time resolution. A discrete-time signal is one which is only defined for integer values
of the argument. We denote such signals with a square bracket, e.g. x[n], where n is only allowed
to be an integer. These signals can then be stored in the memory of a computer, e.g., in a MATLAB
vector, or in an array/string.
The conversion from CT to DT is done by sampling the CT signals at regular intervals. For instance,
in Figure 22.3 we illustrate a waveform x(t) which is sampled every Ts time units to generate a DT
signal x[n],
x[n] = x(nTs ),
(22.11)
where Ts here is the sampling period, and n is an integer. Hence fs = 1/Ts is the sampling frequency.
𝑥(𝑡)
𝑡
Suppose that we wish to
sample this waveform and
store/process the samples on
a computer.
𝑥 2 = 𝑥(2𝑇𝑠 )
0
0
1 2
𝑇𝑠 2𝑇𝑠
𝑛/𝑡
𝑥[𝑛]
0
1
𝑛
Take a snapshot of 𝑥(𝑡) every
𝑇𝑠 time units, 𝑥 𝑛 = 𝑥 𝑛𝑇𝑠 .
e.g. 𝑥 2 = 𝑥(2𝑇𝑠 )
This is the sequence of
numbers used to represent
𝑥 𝑡 on a computer, e.g.
Combined with 𝑇𝑠 we can
reconstruct some
representation of the original
signal
Figure 22.3: Sampling a continuous waveform.
In DT, the complex exponential is written as ejΩn , for integer values of n. If the DT signal is the result
of sampling a continuous-time signal at frequency of fs samples per second, then the sampling period
(time between consecutive samples) is f1s seconds. Hence, an angular frequency of Ω radians per
sample in DT, corresponds to an angular frequency of Ωfs radians per second in CT and a frequency
s
of Ωf
2π Hz.
CHAPTER 22. WEEK 10, CLASS 1: RETURN OF SPECTRAL ANALYSIS AND THE FOURIER TRANSFORM120
We can represent the discretized signal as a vector. If N samples of the signal are taken, the discrete-time
signal x[n] from time n = 0, 1, 2, · · · , N − 1 can be written as an N × 1 vector as follows


x[0]
 x[1] 


x=
(22.12)

..


.
x[N − 1]
Chapter 23
Week 10, Class 2: Computing the
Discrete Fourier Transform
23.1
DFT lecture [40 min]
23.2
Projection onto a Basis
Since there are N vectors vi , each of which has N elements, the vectors vi form an N -dimensional,
orthonormal basis for the space of N -dimensional complex vectors. In other words, any N -dimensional
complex vector can be written as a linear combination of the vi vectors.
Since v0 , v1 , · · · , vN −1 form an orthonormal basis, we can find coefficients a0 , a1 , · · · , aN −1 such
that any N -dimensional vector x can be expressed as
x = a0 v0 + a1 v1 + · · · + aN −1 vN −1 .
(23.1)
Additionally, from the properties of orthonormal bases, we know that
ai = viH x .
(23.2)
H
x = (v0H x)v0 + (v1H x)v1 + (v2H x)v2 + · · · + (vN
−1 x)vN −1
(23.3)
Therefore
Since the vi are complex exponentials of different frequencies, we have decomposed the signal x
into a sum of scaled complex exponentials at different frequencies. √
The term viH x thus tells us "how
i
j2π N
n
much" (magnitude and phase) of the complex exponential e
/ N (which is represented by vi )
is present in the signal x.
The operations of computing the coefficients of the vi terms in (23.3) can be accomplished by a matrix
multiplication. Consider an N × N matrix W whose i-th row equals viH . In other words
W = [v0 v1 v2 . . . vN −1 ]H
121
(23.4)
122
CHAPTER 23. WEEK 10, CLASS 2: COMPUTING THE DISCRETE FOURIER TRANSFORM
This matrix is known as the N -point DFT matrix. If we write out its entries, we have

1
1
1
1
···
1
− 2πj
− 2πj
− 2πj
− 2πj
1
N
N 2
N 3
N (N −1)
e
e
e
·
·
·
e

2·2πj
2·2πj
2·2πj
2·2πj
1
e− N
e− N 2
e− N 3
···
e− N (N −1)
1 
3·2πj
3·2πj
3·2πj
3·2πj

W = √ 1
e− N
e− N 2
e− N 3
···
e− N (N −1)
N
..
..
..
..
 ..
..
.
.
.
.
.
.
1
e−
(N −1)·2πj
N
e−
(N −1)·2πj
2
N
e−
(N −1)·2πj
3
N
···
e−
(N −1)·2πj
(N −1)
N










(23.5)
and the vector of weights a can be computed using a matrix-vector multiply
a = Wx .
By recalling the operations involved in matrix multiplication, we can see that
 H 
v0 x
 v1H x 


a= . 
 .. 
H
vN
−1 x
(23.6)
(23.7)
a is thus a vector that tells us how much of the different complex exponentials vi are present in x.
This vector, a, is known as the DFT of x, and this is what fft(x) computes in MATLAB. Computing
a is called taking the DFT of x.
Matlab Tip for Generating DFT Matrix
The N -point DFT matrix can be generated in MATLAB using W=1/sqrt(N)*dftmtx(N).
The N -point inverse DFT matrix (explained later) can be generated as
W_inv= 1/ sqrt(N)*conj(dftmtx(N)).
Exercise 23.1
1. What is the transformation matrix W for N=2?
2. What is the transformation matrix W for N=4?
3. Verify that the transformation matrix W for N=64 has the form given below by writing out several representative terms, then confirming your answer
√ using the Matlab
command dftmtx. Note Matlab includes an additional factor of 1/ N so you need to
include this factor in your comparison.


1
1
1
1
···
1
2πj
2πj
2πj
2πj
1 e− 64
e− 64 2
e− 64 3
· · · e− 64 63 


2·2πj
2·2πj
2·2πj


− 2·2πj
−
2
−
3
1 e 64
e 64
e 64
· · · e− 64 63 
1


3·2πj
3·2πj
3·2πj
3·2πj
WN=64 = 1 e− 64
e− 64 2 e− 64 3 · · · e− 64 63 
8

..
..
..
..
 ..

..

.
.
.
.
.
.
63·2πj
63·2πj
63·2πj
63·2πj
− 64
− 64 2
− 64 3
− 64 63
1 e
e
e
··· e
Now let’s project some vectors onto the DFT basis, to figure out how much of each frequency (magnitude and phase), is present in a signal.
CHAPTER 23. WEEK 10, CLASS 2: COMPUTING THE DISCRETE FOURIER TRANSFORM
Exercise 23.2
Generate a 64-point vector of ones in MATLAB (e.g., with ones()) and take its DFT by
multiplying with the DFT matrix (you found this 64-point DFT matrix in the previous exercise).
Plot the magnitude of the resulting vector. Explain what the plot means and why it looks that
way.
Exercise 23.3
Generate a cosine in MATLAB as follows:
x = cos([0:63]/16*2*pi);
For example, this could represent a cosine with frequency f = 1/16 Hz, which is written as
cos(2πt/16), sampled every second (fs = 1 Hz) for 64 seconds. It could also represent any
cosine with f /fs = 1/16 (a sampling frequency of 16× the signal frequency).
Take the DFT of this vector using the DFT matrix or the fft() command and plot the
magnitude and phase of the resulting vector. You may find the subplot function useful here.
1. What is the index corresponding to the largest value on the magnitude plot? What column of the v matrix (or corresponding row of the W matrix) does this index correspond
to? What value of index i? What is the angular frequency? How does this relate to the
original signal?
2. What is the phase value for the index corresponding to the largest magnitude? How
does this relate to the original signal?
Exercise 23.4
Generate a sine in MATLAB as follows:
x = sin([0:63]/16*2*pi);
Take the DFT of this vector using the DFT matrix or the fft() command and plot the
magnitude and phase of the resulting vector. You may find the subplot function useful here.
1. What is the index corresponding to the largest value on the magnitude plot? What column of the v matrix (or corresponding row of the W matrix) does this index correspond
to? What value of i? What is the angular frequency? How does this relate to the original
signal?
2. What is the phase value for the index corresponding to the largest magnitude? How
does this relate to the original signal?
Exercise 23.5
Load the file tuning_fork_day2.mat which contains samples from a tuning fork taken at 44100
123
124
CHAPTER 23. WEEK 10, CLASS 2: COMPUTING THE DISCRETE FOURIER TRANSFORM
Hz, and three different vi vectors that are labeled with their index i. The vectors correspond
to one of three different frequencies (440 Hz, 329 Hz, 294 Hz ).
1. Determine which vector corresponds to which frequency.
2. Use these vectors to determine the frequency of the tuning fork.
Note that if the sample rate is fs samples/second (Hz), then an angular frequency Ω = 2πi/N
(radians/sample) corresponds to a frequency f (in Hz) of
f=
Ω
ifs
=
2π
N
(23.8)
(in radians/sample * samples/second * 1/radians = Hz)
If you have extra time, we invite you to begin work on the homework with your table group.
Chapter 24
Week 10 Homework: Behavior of the
Discrete Fourier Transform
Exercise 24.1
OPTIONAL problem (will not be graded; feel free to skip!)
By hand (meaning using your algebra skills,
not a computer), find the 64-point DFT of the
vector x whose n-th entry is cos π4 (n) (note that the convention here is that the earliest
entry is considered the zeroth entry).
You may work through this problem using the following steps. If you would
prefer to try this problem without scaffolding, feel free to take your own approach to
finding the DFT vector. To allow for different approaches, intermediate steps in the
suggested approach will not be graded.
1. Write out several representative terms of the vector x whose n-th entry is cos π4 (n) .
You do not need to write out all 64 terms.
2. Using the fact that cos θ = 12 ejθ + 12 e−jθ , show that x can be written as:


1
π
π
 1 e 4 j + 1 e− 4 j 
 12 π 2j 21 − π 2j 


x =  2e 4 + 2e 4 


..


.
1 π
4 63j
2e
(24.1)
π
+ 12 e− 4 63j
3. Show that the ith entry of the DFT of x is given by viH x, where:
viH x =
63 X
1
k=0
8
e
−2πij
64 k
1 π kj 1 − π kj
e4 + e 4
2
2
4. Using the fact that e−jθ = e−jθ · ej2πn = ej(2πn−θ) , because ej2πn = 1, for all integers
n, show that:
63
viH x =
(56−i)π
1 X (8−i)π kj
e 32
+ e 32 kj
16
k=0
= 4(v8−i · v0 + v56−i · v0 )
125
126
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
5. Knowing that vi are orthogonal, so
(
0
vi · vj =
1
ifi ̸= j
.
ifi = j
What are the two possible values for viH x, and for what indices i and j do they each
occur? This information defines the DFT of the given signal.
Exercise 24.2
Take a 64-point DFT of a cosine wave of angular frequency
π
4
radians per sample in MATLAB.
1. In Matlab generate a vector x = cos(pi/4 * [0:1:63]);.
2. Use MATLAB’s fft() to plot the magnitude of the DFT of the cosine.
3. Explain the reason for the features of the DFT magnitude plot—how many frequency
spikes there are, at what normalized angular frequencies (in radians per sample) they
occur, and how these observations relate to the form of the sampled signal.
24.1
Exploring Properties of the DFT
In signal processing, the DFT√is often written in terms of a summation, and there is some variation on
the scale factor used (i.e. the N term in the definition of W). When written in terms of a summation,
the N -point DFT can be expressed as
N −1
2π
1 X
x[k]e−j N ik ,
Xi = √
N k=0
(24.2)
where Xi is the i-th entry of the vector a for i between 0 and N − 1.

v0H x
v1H x
..
.


X0
X1
..
.


 


 

a=
=


 

H
XN −1
vN −1 x
(24.3)
Important Note on Notation
When the discrete Fourier transform was introduced we used ai to denote the components of the
Fourier transform, which is the convention used to indicate vector weights in linear algebra. But
now we will switch to using the convention in Fourier transforms: We will use Xi to denote the
components of the Fourier transform of the signal x[k]. In other words, capital letters in the frequency
domain corresponds to lower case letters in the time domain.
Using the Fourier Transform notation convention, Xi is "how much" (both magnitude and phase) of
the frequency 2π Ni radians per sample is present in the signal x[n].
127
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
Fourier Basis v_49 N=50
0.15
0.1
0.05
0
-0.05
-0.1
Real
Imaginary
-0.15
0
10
20
30
40
50
Figure 24.1: The real and imaginary components of the Fourier basis vector v49 for a 50-point DFT.
Fourier Basis v_-1 N=50
0.15
0.1
0.05
0
-0.05
-0.1
Real
Imaginary
-0.15
0
10
20
30
40
50
Figure 24.2: The real and imaginary components of the Fourier basis vector v−1 for a 50-point DFT.
Writing the DFT in this form enables us to more directly understand certain properties of these
transforms, but on the other hand, writing it in matrix-vector form enables us to directly connect them
to concepts in linear algebra such as projection and bases which we used last semester.
In MATLAB, the fft command returns the DFT as computed using the matrix product given in the
following equation, where W is the DFT matrix given in the previous assignment.
a = Wx .
(24.4)
Similarly, the MATLAB command ifft command returns the IDFT as computed using the matrix
product given in the following equation.
x = W−1 a .
24.2
(24.5)
Frequencies and Periodicity of the Fourier Transform
The angular frequencies that are computed by the DFT range from 0 to NN−1 2π radians per sample,
since the frequencies are evaluated for 2πi
N for i = 0, 1, · · · , N − 1. However, this is not always the
most useful way to visualize the DFT. Instead, we often prefer a shifted DFT that is centered around
zero.
In this section you will be showing that the DFT is periodic with period N , and exploring some
important consequences of this fact.
Before getting into the nitty gritty of a proof, let’s build some intuition about the periodicity of the DFT.
Figure 24.1 plots the real and imaginary components of the vector v49 for a 50-point DFT. Similarly,
Figure 24.2 plots the real and imaginary components of the vector v−1 for a 50-point DFT. If you
examine these figures closely, you will see that the v−1 and v49 are in fact the same exact vector!
H
H
Based on Equation 24.3, X49 = v49
x and X−1 = v−1
x. Since it appears, based on Figures 24.1 and
24.2, that v49 = v−1 , it follows that X49 = X−1 ! Restated slightly, we have that X−1 = X−1+N
128
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
(where N = 50 in this case). In fact, it is also the case that X−1 = X−1+N = X−1+2N . This is the
essence of what we mean when we say that the DFT is periodic with period N .
Now that you know what it means for the DFT to be periodic with period N (a fact you will prove
momentarily), you might ask the question “why do we care?” One amazing implication of this fact
is that while you have already seen that v0 , . . . , vN −1 form a basis set, vi , . . . , vi+N −1 also form a
basis set for any integer i. While this might not seem like a big deal, we will use this fact to shift the
range of frequencies for our basis set to be centered around 0. This re-centered basis set will connect
more meaningfully to the underlying continuous signals that we are characterizing.
Exercise 24.3
Show that the N -point DFT is periodic with period N . In other words, use (24.2) to show that
Xi+N = Xi
(24.6)
You may work through this problem using the following steps. If you would prefer
to try this problem without scaffolding, feel free to take your own approach to
demonstrating periodicity. To allow for different approaches, intermediate steps in
the suggested approach will not be graded.
1. To start, show that Xi =
2. Then, show that Xi =
√1
N
√1
N
PN −1
k=0
PN −1
k=0
2π
x[k]e−j N ik × e−j2πk
2π
x[k]e−j N (i+N )k = Xi+N
Note: We have not given you every step to the proof, you will need to fill in the steps to show
fully that Xi+N = Xi .
Exercise 24.4
Find the smallest positive value of k for which Xk = X−1 .
Exercise 24.5
Assuming that N is even, find the smallest positive value of k for which Xk = X−N/2 .
Your answers to the previous parts should indicate that a positive frequency near 2π is equivalent to
a lower negative frequency. If we wish to use the DFT to analyze the unique frequency content of
signals, it is helpful to understand exactly what we are seeing. If you are analyzing a purely real signal,
the DFT will be entirely symmetric about the origin since cos θ = cos(−θ), so the DFT spectrum of a
signal with frequency ω between 0 and 2π will show two peaks, one at ω and one at 2π − ω which
are equivalent.
For this reason, it is often clearer and more helpful to visualize frequencies ranging from −π radians
per sample to π − N2 π radians per sample instead (the upper limit is one sample less than π so you still
have N points and −π is equivalent to π anyway). In other words, it is helpful to plot the frequency
content of signals centered around 0 radians per sample, as the low frequency components will then
be close to zero and large high positive and negative frequency components will be at the two edges.
Exercise 24.6
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
129
Consider sampling the continuous time signal x(t) = sin(t) at a rate of 1 Hz (e.g., x[n] =
sin(n)). The amplitude spectrum of this signal for a 50-point DFT will be the following.
25
Amplitude
20
15
10
5
0
0
1
2
3
4
5
6
7
Frequency (rad/sample)
Exercise: Plot or sketch the amplitude spectrum if we recenter the range of frequencies
around 0 rad/sample.
This figure was made using the following MATLAB code:
N = 50;
x = sin([0:N-1]);
frequencies = linspace(0, 2*pi*(N-1)/N, N);
stem(frequencies, abs(fft(x)));
h = xlabel('Frequency (rad/sample)');
h = ylabel('Amplitude');
In MATLAB, in order to generate frequency plots centered around 0, we can run the results of fft
through fftshift. fftshift reorders the entries of the result of fft such that the DFT entry
corresponding to a frequency of 0 appears in the middle of the resultant vector. Consider checking out
the Matlab help page for fftshift if you want more details on how it works. While the fftshift
command will reorder the output of fft (remember, these outputs will be the y values of your plot),
you need to do a bit more work to compute the values on the x-axis (i.e. the range of frequencies).
As stated earlier, the shifted range of frequencies goes from −π radians per unit time to π − N2 π
radians per unit time. It turns out this is a bit of an oversimplification in that the frequency ranges will
have to be modified slightly when N is an odd number (see Appendix 24.6 for the gory details). The
following MATLAB code will compute the corresponding frequencies (x-axis values) for an N -point
DFT regardless of whether N is even or odd.
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
130
Matlab Code to Compute Shifted Frequencies
frequencies_shifted = linspace(-pi, pi-2/N*pi, N) + pi/N*mod(N,2);
Exercise 24.7
Using fftshift in addition to the line of code above, plot the zero-centered amplitude
spectrum of the signal x(t) = sin(t) sampled at t values 0, 1, . . . , 49 (this is the same signal
you encountered previously). To get you started, here is code for generating the sampled
version of the signal.
N = 50;
x = sin([0:N-1]);
24.2.1
Aliasing
One interesting question that you may have is “how quickly do we need to sample a CT signal to
analyze the frequencies present?” Remarkably, if a CT signal is sampled at greater than twice the
maximum frequency present in the signal, it can be perfectly reconstructed from its DT samples. In
other words, no information about a CT signal is lost if it is sampled at greater than twice the maximum
frequency present in the signal. As an example, audio CDs are sampled at 44100 Hz because humans
can hear up to 22000 Hz, and so sampling at a frequency greater than 44000 Hz will preserve all audible
information in an audio signal (the extra 100Hz is to account for hardware non-idealities). (This result
is known as the Nyquist Sampling Theorem).
If you sample a CT signal too slowly, (i.e. if Ts is too large), you cannot obtain an accurate representation
of the continuous waveform. In fact, if sampled at too low a rate, CT signals of different frequencies
can be indistinguishable in DT. Consider the signal shown in Figure 24.3, where two cosine waves
at frequencies of 440 Hz and 2560 Hz are shown. The samples are taken at a rate of 3000 Hz. The
samples, illustrated by the stems in the plot, are identical for both signals.
Cosine at 440 Hz, sampled at 3000Hz
1
0.5
0
-0.5
-1
0
0.001
0.002
0.003
0.004
0.005
0.006
0.007
0.008
0.009
0.01
0.006
0.007
0.008
0.009
0.01
time/seconds
Cosine at 2560 Hz, sampled at 3000Hz
1
0.5
0
-0.5
-1
0
0.001
0.002
0.003
0.004
0.005
time/seconds
Figure 24.3: Cosine waves (blue) at 440 Hz and 2560 Hz, sampled at 3000 Hz (pink stems). DT samples for
both cosine waves are identical. Figure adapted from ThinkDSP by Allen Downey.
131
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
The phenomenon that is illustrated in Figure 24.3 is known as aliasing. The cosine at 2560Hz is aliased
such that it looks like a 440 Hz cosine wave. The word alias comes from the Latin root alius meaning
other.
Let’s do an exercise to get a qualitative understanding of the frequency content of an audio signal.
Exercise 24.8
Let’s hear the two cosines depicted above using MATLAB. Type the following at the MATLAB
prompt.
fs = 3000; %set the sample rate
t = [0:1/fs:1]; %create 1 second long vector representing time at sample rate fs
1. Create a cosine at frequency of 440 Hz at the sample rate of 3000 Hz, and play it through
your speaker by running the following code
x440 = cos(2*pi*440*t);
sound(x440, fs);
2. Create a cosine at frequency of 2560 Hz at the sample rate of 3000 Hz, and play it through
your speaker by running the following code
x2560 = cos(2*pi*2560*t);
sound(x2560, fs);
3. Please explain what you heard.
24.3
Read before next class: Inverse DFT
As we have seen above, a DFT gives us information about the frequency spectrum of a time-domain signal.
Sometimes, however, we want to be able to go the other direction: to reconstruct the time domain signal
given the frequency spectrum. For this, the inverse DFT is useful.
The inverse of the DFT matrix is known, not surprisingly, as the Inverse DFT matrix. It turns out that
because W is made up of orthonormal vectors, W−1 = WH . When you have complex entries as we do
here, the "orthogonal" matrices are also referred to as unitary matrices. It turns out that
x = WH a
(24.7)
This is what ifft(x) computes in MATLAB. Computing x from a is called taking the IDFT of a. Writing
out the entries of WH = W−1 , we have


1
1
1
1
···
1
2πj
2πj
2πj
2πj
1
eN
eN 2
eN 3
···
e N (N −1) 


2·2πj
2·2πj
2·2πj
2·2πj
1
e N
e N 2
e N 3
···
e N (N −1) 


1
3·2πj
3·2πj
3·2πj
3·2πj
,
W−1 = √ 
(24.8)
N
N 2
N 3
N (N −1)


1
e
e
e
·
·
·
e
N

..
..
..
..
 ..

..
.
.

.
.
.
.
(N −1)·2πj
(N −1)·2πj
(N −1)·2πj
(N −1)·2πj
2
3
(N
−1)
e N
e N
··· e N
1 e N
The IDFT can also be expressed as a summation.
N −1
2π
1 X
x[n] = √
Xk ej N kn ,
N k=0
We will be using the IDFT when we work with filtering in the frequency domain.
(24.9)
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
132
24.4 Optional enrichment reading: The Fourier transform is complex valued!
We’ve been pretending that the Fourier transform is a real-valued, nonnegative function by always plotting
its absolute value. But the fact that it’s actually a complex-valued function has some major consequences. For
example, let’s think again about the Fourier transform of sin(2πt) and sin(2πt − π/2). Consistent with the
mathematical notation you will see later in the class, let Xi denote the component of the Fourier transform
associated with the ith frequency. The figure below shows the two sine waves and then plots the absolute
value of their Fourier transforms.
Figure 24.4: Absolute value of the Fourier transforms of two sin waves with a phase shift. The middle plot
corresponds to the sine wave in blue; the right plot corresponds to the phase-shifted sine wave in red.
In both Fourier transforms in Figure 24.4, |X1 | = |X−1 | = 0.5. Based on our discussion in the previous
section, this is completely expected. The frequency of both sine waves is 1, so we expect there to be spikes
at 1 and -1. The amplitude of both sine waves is 1, which is why the spikes have height 1/2. So, are the two
Fourier transforms identical? No!
We will see that the Fourier transform consists of complex numbers, and here we’ve been looking at the
graph of its absolute value. The absolute values are equal, but the complex numbers are not. Figure 24.5
breaks down the Fourier transform of sin(2πt) and sin(2πt − π/4) into its real and imaginary parts. Take
note of the height of the frequency components, this will make more sense after working through some of
the upcoming examples.
Figure 24.5: Fourier transform of sin(2πt) and sin(2πt − π/4) broken down into its real and imaginary parts.
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
133
Sometimes we are only interested in the absolute value of the Fourier transform. If we are trying
to analyze a complicated wave, the absolute value of its Fourier transform indicates the frequencies and
amplitudes of the basic sine wave building blocks which comprise the wave. But, the above example illustrates
one reason why its important that the components of the Fourier transform are complex numbers: the
absolute value alone cannot tell us about the phase shift of the basic sine wave building blocks. In another
sense, these complex weights of the different frequencies arise from the need to add complex exponentials in
such a way that the sum (the signal we’re recreating) is real.
24.5 Appendix A (optional reading): Orthogonality of Complex
Exponentials
Note that
1

k
j2π N
·1
 e

k
1
·2
j2π
i
i
i

viH vk =
1 e−j2π N ·1 e−j2π N ·2 · · · e−j2π N ·(N −1)  e N

N
..

.







k
ej2π N ·(N −1)
N −1
1 X j2π k−i ·ℓ
N
=
e
N
ℓ=0
=
1
N
N
−1 X
ej2π
k−i
N
ℓ
(24.10)
ℓ=0
If k = i, then (24.10) becomes
viH vi =
N −1
1 X j2π i−i ℓ
N
e
N
(24.11)
N −1
1 X j·0
e =1
N
(24.12)
ℓ=0
=
ℓ=0
If k ̸= i, observe that the right-hand-side of (24.10) is a geometric series with N terms, where the ratio
k−i
of consecutive terms is ej2π N . Using the geometric series formula
L−1
X
m=0
rm =
1 − rL
1−r
N −1
1 X j2π k−i ℓ
N
e
N
ℓ=0
N
j2π k−i
N
1
−
e
1
=
·
k−i
N
1 − ej2π N
viH vk =
(24.13)
(24.14)
(24.15)
k−i
1 1 − ej2π N ·N
·
k−i
N
1 − ej2π N
1 1 − ej2π(k−i)
=
·
N 1 − ej2π k−i
N
=
(24.16)
(24.17)
CHAPTER 24. WEEK 10 HOMEWORK: BEHAVIOR OF THE DISCRETE FOURIER TRANSFORM
134
Since k − i is an integer that is non-zero, ej2π(k−i) = 1. Hence,
viH vk =
N −1
1 X j2π k−i ℓ
N
e
N
(24.18)
ℓ=0
(24.19)
=0
Therefore, we have
viH vk
(
1
=
0
if i = k
if i ̸= k
(24.20)
24.6 Appendix B (optional reading): Determining Shifted Frequency
Values
Earlier, we suggested that for a DFT shifted such that it is centered around a frequency of 0, the frequency
range should go from −π to π − N2 π rather than 0 to 2π NN−1 (as in the unshifted case). It turns out that this
result only holds when N is an even number. The reason that we can’t use this exact same range when N
is an odd number is that the frequency value 0 must be one of the frequencies represented in the shifted
frequencies (after all, this corresponded to i = 0 in the unshifted frequency spectrum). As a minimalistic
example to drive home this point, think of the DFT when N = 3. If we cover the frequency range from −π
to π − N2 π (remember, N = 3) in this case, we will wind up with the frequencies −π, − 13 π, 31 π . This is
problematic since the the frequency 0 doesn’t appear in this list. For N odd, it turns out the right range of
π
π
frequencies is
−π + N to π − N . Which in our minimalistic example would give the 3 frequency values
2
2
− 3 π, 0, 3 π . This looks good since the frequency value 0 appears in this list.
One way to write code to handle both odd and even N is by using an if statement to check whether N
is even or odd. In order to do this, we can make use of MATLAB’s mod function (mod stands for the modulus
operator, which you likely have never encountered before). When n and k are both positive, mod(n, k) is
the remainder of n divided by k. Therefore, mod(N, 2) will return 1 if N is odd and 0 if N is even. The
following code will give the correct shifted frequency values for both even and odd N .
5
if mod(N, 2) == 0
% N is even
frequencies_shifted = linspace(-pi, pi - 2/N*pi, N);
else
% N is odd
frequencies_shifted = linspace(-pi + pi/N, pi - pi/N, N);
end
Alternatively, you can write the whole thing on one line (avoiding the need for the if statement entirely).
frequencies_shifted = linspace(-pi, pi-2/N*pi, N) + pi/N*mod(N,2);
If it’s not clear that these two blocks of code are equivalent, you can test out an odd and an even value of
N and verify that they are the same.
Chapter 25
Week 11, Class 1: Filtering
Learning Objectives
This week:
• Reconstruct a signal by computing the inverse DFT
• Filter a signal by altering data in the frequency domain
• Understand some of the pros and cons of filtering in the frequency domain
• Optional: Look at other options for filtering and processing your data.
25.1
HW review [20-30 min]
Exercise 25.1
With your table, go through the solutions to the homework due today and identify a list of key
concepts. Identify which of these concepts you feel comfortable with and which are still confusing.
Try to resolve your confusions (about topics or specific problems) with the folks at your table and by
talking to an instructor.
25.2
Introduction to Filtering
Filtering is the process of removing unwanted components from a signal. In this section we will be examining
new methods for filtering signals based on writing computer programs to process a raw signal and compute
its filtered version.
Suppose that you have some signal and you’d like to either enhance or diminish certain frequency ranges.
Now that we know about the DFT and the IDFT, it seems natural to approach this problem in the following
steps.
• Transform our time-domain signal into the frequency domain (in MATLAB this would be done using
the fft command).
• Modify the signal in the frequency domain (e.g., reducing or increasing the amplitude of certain
frequencies).
• Convert the modified frequency representation of the signal back into the time domain (in MATLAB
this would be done using the ifft command).
135
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
25.2.1
136
Filtering in the Frequency Domain
In this exercise, you’ll be implementing a filter that maps the time domain signal to the frequency domain,
performs modifications in the frequency domain, and then maps back to the time domain.
Exercise 25.2
In MATLAB, type load handel. This command will load a data file provided with MATLAB that
contains an audio segment y sampled at Fs samples per second.
1. OPTIONAL: You may use sound(y/max(abs(y)), Fs) to hear this audio signal. We divide
y with the maximum of the absolute value in order to normalize it. The computer speakers
should produce the sound of a choir singing "Hallelujah..." with strings in the background. It
sounds a bit scratchy, like an old recording.
2. What are the highest and lowest angular frequencies that this signal can have (in rad/s), given
the sample rate, and assuming that it was sampled at a rate such that there was no aliasing?
Hints: 1) Refer to Appendix B of Chapter 10 for a summary of shifted frequencies, and note
π
π
that since N is odd, the shifted DFT’s frequencies will go from (−π + N
) × fs to (π − N
) × fs
radians per second. 2) When we state "lowest angular frequency" we are not referring to
the lowest absolute value of a given frequency component. 3) Remember that aliasing is
dictated by the sampling frequency. Take a few minutes to investigate Nyquist frequency, the
sampling frequency to ensure that no aliasing occurs, and its relation to the highest frequency
component of your signal.
Exercise 25.3
1. Let’s use frequency analysis to change the sound of the handel recording. Using the fft
and ifft commands, implement a low-pass filter which suppresses the frequencies in the
following ranges [−F s/2, −F s/4] and [F s/4, F s/2] Hz, by a factor of 10 in the handel data.
2. Plot the absolute values of the DFTs of the signal before and after you do this processing. How
would you expect the filtered sound to be different?
3. OPTIONAL: You may play the filtered signal on your computer to see if it sounds as you
expected. Filtered this way, the new sound is slightly less brassy (perhaps due to reducing high
frequency sounds) and a bit more muffled, like you were listening through a wall. In order not
to play too large an amplitude through your speaker, you should normalize the amplitude of
the signal by dividing by the largest value in your signal. If your processed signal is contained
in yfilt, you can play it through your speakers using
sound(real(yfilt)/max(abs(real(yfilt))), Fs). Note that filtering the signal in
this manner may cause your signal to have imaginary components.
If you did this as expected, your amplitude spectrum before and after should look like the following.
137
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
Raw Power Spectrum
700
700
600
600
500
500
400
300
300
200
100
100
-2
-1
0
Frequency rad/s
25.2.2
400
200
0
-3
Filtered Power Spectrum
800
Amplitude
Amplitude
800
1
2
3
0
-3
-2
10 4
-1
0
Frequency rad/s
1
2
3
10
4
Limitations of Frequency Domain Filters
Next, we’ll try a second pass (Get it? Pass? Ha ha ha) at filtering in the frequency domain. Through this
exercise we’ll discover some of the limitations of this approach to filtering. Get the data for this exercise
from here, and unzip it into some folder on your computer.
Exercise 25.4
In this exercise we will investigate some limitations of noise removal using the DFT-IDFT approach. To begin, load the wav files using [x275, Fs] = audioread('Disturbance275.wav'),
[x261, Fs] = audioread('Disturbance261.wav'), and [x_orig, Fs] = audioread('DisturbanceOrig.wav')
Note: if you copy and paste the code above, you may have to retype the apostrophes in MATLAB.
• Disturbance.wav contains an audio sample from an obscure movie from the late 1970s. This is
the original, uncorrupted signal.
• Disturbance275.wav contains the same sample corrupted by noise in the form of a cosine at
275.6181 Hz. This frequency is carefully selected to be one of those computed by the DFT.
• Disturbance261.wav contains the same sample corrupted by noise in the form of a cosine at
261.626 Hz.
If you wish, you may play all three sound files using sound(x_orig, Fs), etc.
To explore the three sounds in the frequency domain, we suggest you plot the magnitude of the DFT
of the three signals. You may use the code segment below, which plots frequencies in Hz.
5
N = length(x275);
f = linspace(-Fs/2, Fs/2 - Fs/N, N) + Fs/(2*N)*mod(N, 2);
X275 = fft(x275);plot(f,fftshift(abs(X275)),'b');hold on;
X261 = fft(x261);plot(f,fftshift(abs(X261)),'m');
X_orig = fft(x_orig);plot(f,fftshift(abs(X_orig)),'g');
legend('x275', 'x261', 'x_{orig}');xlabel('Frequency (Hz)');ylabel('Amplitude');
We invite you to try to remove the noise from the corrupted signals by filtering out the two
frequency components with the highest magnitudes using the FFT and IFFT. If you like, you
can play the filtered signals to hear if you have successfully removed the noise (or ask a friend or
teacher to describe the sound).
1. Try to remove the noise in x275 by eliminating the two frequency components with the
highest magnitudes in the DFT. Plot the magnitude of the DFT of the filtered sound data.
138
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
2. Try to remove the noise in x261 by eliminating the two frequency components with the
highest magnitudes in the DFT. Plot the magnitude of the DFT of the filtered sound data.
3. Referencing your DFT plots, please explain the differences in the effectiveness of the suggested
filtering approach in removing the noise in x275 and x261. How might you improve upon
the suggested method?
You will notice that this approach can remove the noise very well in one case and not so well in the other.
Note that the DFT computes the frequency content of a signal at frequencies Ni fs , for i = 0, 1, 2, · · · , N − 1,
where N is the length of the vector. Hence, there are some frequencies that lie in between the frequencies
that are analyzed by the DFT. As such the strategy of nulling out certain entries of the DFT output does
not work well. Later in this assignment, you are going to implement a notch filter using a set of DT signal
manipulations, i.e. you will not transform the signal into the frequency domain. The design and analysis of
the filter however, will be done in the frequency domain.
25.3 Optional, but highly recommended section: Time Domain
Filters
Next, we will learn about and implement filters in the time domain. These can be very useful for processing
your data (and in your projects). We will see how delaying, scaling, and adding signals together can impact
the frequency content of signals. Our hope is that at the end of this assignment, you will be somewhat
comfortable with filters and how they work, and be ready to use them when you work on your project on
motion sensing and interpretation. In particular, we will learn how difference equations can be used
to filter signals without ever taking a Fourier transform. You may not be familiar with the term difference
equation, however, you’ve seen them in various forms in the past whether you realize it or not. A difference
equation can be used to define a sequence by specifying how the nth element of the sequence relates to
various quantities, including (potentially) previous terms in the sequence. For instance, the sequence of
positive odd numbers can be defined by the following difference equation.
x[0] = 1
x[n] = x[n − 1] + 2, for all integers n > 0
While this is a very basic example, you’ve probably seen much more interesting uses of difference
equations. For example, in ModSim you may have seen predator-prey models whose updates were defined
using difference equations. Importantly, as it relates to filtering, we can define the input-output relationships
of a discrete-time filter using difference equations.
In this problem you’ll see how a difference equation can be used to generate an output (filtered) signal, y,
from an input (raw) signal, x.
Exercise 25.5
Consider the following difference equation, where x[n] is the input and y[n] is the output. This
system is known as a three point moving average filter.
y[n] =
1
(x[n + 1] + x[n] + x[n − 1]).
3
(25.1)
The output y at a given time n, is the average of the next input, current input and previous input.
1. Sketch the DT signal x[n], which takes the following values (we’ve picked integers for convenience).
139
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
x[0] = 1, x[1] = −2, x[2] = 0, x[3] = −2, x[4] = 2, x[5] = −1.
(25.2)
Sketch y[1], y[2], y[3] and y[4]. What can you say about the variability over time of the signals
x[n] and y[n]?
Exercise 25.6
1. What would the moving average filter do to high frequency signals?
2. Write (and include in your submission) MATLAB code to implement the 3-point moving
average filter on some discrete signal contained in a generic vector x. The filtered output will
be contained in a vector y. You can test your code on x from the previous problem.
Assume that any sample you do not have is zero (e.g., considering the previous problem’s
signal x, you could assume x[6] = 0 when computing y[5]). You may consider either using a
for loop or vector indexing operations to add appropriate MATLAB vectors together.
Exercise 25.7
1. Filter the accelerometer data contained in the file 70bpm-walking-downsampled-5x.mat (from
the M3A5 zip file linked earlier). The first column of the matrix is time, the second is xacceleration, the third is y-acceleration, and the fourth is z-acceleration. Choose a particular
acceleration axis to examine (x, y, or z). Plot both the filtered acceleration data in your chosen
axis and the unfiltered version of the data as a function of time. Comment on the effect that
the filter has on the data.
2. Use MATLAB’s fft and fftshift functions to plot the magnitude of the filtered data in the
frequency domain. Does the plot look like what you expect?
Exercise 25.8
Other examples of difference equations include
y[n] = (x[n] − x[n − 1])/2.
(25.3)
What kind of filter does this most closely correspond to, i.e. is it low-pass, band-pass, or high-pass?
If you are unsure, try sketching a sample waveform like you did with the moving average filter to
try to understand what this filter is doing.
Exercise 25.9
1. Using this new (y[n] = (x[n] − x[n − 1])/2) filter, filter the accelerometer data contained in
the file 70bpm-walking-downsampled-5x.mat. Choose a particular acceleration axis to examine
(x, y, or z). Plot both the filtered acceleration data in your chosen axis and the unfiltered
version of the data as a function of time. Comment on the effect that the filter has on the data.
140
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
2. Use MATLAB’s fft and fftshift functions to plot the magnitude of the filtered data in the
frequency domain. Does the plot look like what you expect?
In its most general form, a linear, constant coefficient difference equation can be written as follows
∞
X
gk y[n − k] =
k=−∞
∞
X
hℓ x[n − ℓ]
(25.4)
ℓ=−∞
where gk and hℓ are the constant coefficients, k and ℓ are indices, the input is x[n], and the output is y[n].
Alternatively, we can denote the difference equation as
· · · + g−2 y[n − 2] + g−1 y[n − 1] + g0 y[n] + g1 y[n + 1] + g2 y[n + 2] + · · ·
= · · · + h−2 x[n − 2] + h−1 x[n − 1] + h0 x[n] + h1 x[n + 1] + h2 x[n + 2] + · · ·
The filters we have seen so far are all special cases of this.
Exercise 25.10
The general difference equation, shown in Equation (25.4), is a bit abstract. To get a better grasp on
it, let’s look at some specific cases.
1. Identify the coefficients (i.e., the values of gk and hl ) that give the three-point moving average
from earlier in this assignment.
2. Previously, you studied how applying the three-point moving average to a signal affects the
frequencies present. What happens to the frequency spectrum if we include more terms in the
moving average?
25.4
Optional but Recommended: Filtering Experimental Data
Exercise 25.11
Take a look at one of your old data sets from your spring-mass experiments. Any one will do, but
it might be more fun to look at your forced oscillation with your hanging phone, since that has
multiple frequencies. Would you want to apply any filtering to this data? What methods could you
use? Try some out!
If you have lost your past data, Melinda has a collection of experimental data here. It was taken with
phyphox at a sampling rate of 100 Hz.
25.5
OPTIONAL: Linear, Time-Invariant Systems
We have been looking at systems defined by difference equations of the following form
∞
X
k=−∞
gk y[n − k] =
∞
X
ℓ=−∞
hℓ x[n − ℓ]
(25.5)
141
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
where the input is x[n], the output is y[n], and gk and hℓ are constant coefficients. Since this system has
discrete-time inputs and outputs, you can view this system as existing inside a computer, or in a piece of
digital hardware. The system may be a function that filters an input signal array/vector x[n].
It turns out that you can only write a difference equation of this form if the system is linear and timeinvariant (LTI). Therefore, all the work on filtering, frequency responses etc. apply only when systems are
LTI. So we thought it would be important for you to understand what an LTI system is.
25.5.1
What we really want you to know about LTI systems
A system which is linear and time-invariant has the following properties:
• If you scale the input, the output scales by the same amount.
• If your input is the sum of two (or more) simpler signals, the output is the sum of the outputs due to
the two (or more) simpler signals.
• If you shift the input in time, the output shifts by the same amount in time.
These first two points are what make the system linear, and the last make it time-invariant. We’ll
formalize this below.
25.5.2
Precise definition of LTI systems
We call a system linear if, for any input signal of the form
x[n] = a1 x1 [n] + a2 x2 [n],
(25.6)
y[n] = a1 y1 [n] + a2 y2 [n],
(25.7)
the output signal is
where a1 and a2 are any constants, the input x1 [n] gives output y1 [n], and the input x2 [n] gives output
y2 [n].
If you look carefully, you’ll see that these two equations are basically a combination of our two previously
defined requirements for linearity: Scaling the input scales the output by the same amount; if y1 is our output
y[n] for an input x[n] = x1 , then y[n] = a1 y1 will be the output for an input of x[n] = a1 x1 [n]. Likewise, if
the input xn is the combination of two simple inputs x1 + x2 which would normally yield outputs y1 and y2
respectively, then the output y[n] is the combination of those two outputs, or y1 + y2 . Combining these, we
get equations 25.7 and 25.6.
This definition might be familiar from linear algebra. Linearity allows us to decompose our signal into
simpler pieces, analyze the response to those simpler pieces individually and then sum them up.
The system is time-invariant if, given an input signal x[n] with output y[n], the input signal x[n + n0 ]
produces output signal y[n + n0 ]. This must be true for any integer n0 . The time-invariance property means
that if the input is time-shifted by a certain amount, the output is time-shifted by the same amount. This
video from Rose-Hulman gives a few examples of how to determine whether a system is time-invariant or
not.
A system is LTI if it is both linear and time-invariant. The LTI property enables us to decompose our
signal into a sum of simpler signals, analyze the response of our system to these simpler signals at a fixed
time, and then put everything back together again.
The following questions are designed to help you get a little more comfortable with the idea of LTI
systems.
Exercise 25.12
Note: Optional problem!
Determine if the following systems are linear and time-invariant (LTI). Note that we use the
CHAPTER 25. WEEK 11, CLASS 1: FILTERING
142
convention here that the input signals are defined as x[n] and the output signals as y[n].
1. A system for which y[n] = 3x[n].
2. A system for which y[n] = x[n] + 0.1x[n − 1]. This could serve as a simplified model for an
echo chamber.
3. A system for which y[n] = 1000x[n] + 0.1. This could serve as a simplified model of an
op-amp with a small DC offset.
4. A system for which y[n] = (x[n])2 .
From these examples, you hopefully have started to get a sense of how to determine whether an output
equation is LTI or not. But why do we care? While there are other filtering options, only LTI filters can be
subject to frequency domain analysis. For example, non-LTI filters may introduce distortion and new signal
frequencies.
Chapter 26
Week 11: [No] Homework
There is no homework for this week. Hurray! You do still need to submit your self grading, but outside of
that you can... read ahead in the book, review old material, try out the extension chapter, catch up on other
class work, go for a walk, take a nap, etc.
143
Chapter 27
Week 11, Class 2: Systems of 2nd-order
ODEs
Learning Objectives
• Analyze a system of second order ODEs
• Find the eigenmodes for an oscillatory system and connect them to the physical motion of a
mechanical system.
• Relate the motion of an object to the time domain curve of its acceleration.
• Design an experiment to collect interpretable motion data.
27.1
Revisiting Spring-Mass Systems
We have studied the spring-mass system extensively, but so far we’ve always had one degree of freedom one mass whose movement we care about. Now we’ll add complexity and see that our frequency domain
analysis can again be very helpful.
Exercise 27.1
Consider two masses, m1 and m2 , sliding on a frictionless table, attached to each other with a spring.
m1 is attached with a spring to a wall on the left, and m2 is attached with a spring to a wall on the
right, as shown in the Figure below. Find the equation of motion for each mass. We recommend
using the equilibrium position of each mass as the origin for that mass.
As always, we recommend following a consistent process when solving for the equations of motion
for a new system:
1. Define your reference frames. In this case we recommend two inertial frames fixed at the
equilibrium position of each mass, as shown in the figure below.
2. Draw an FBD for each mass.
3. Define your forces. In this system, you will need to pay particular attention to the direction of
each spring force, and keep in mind that the middle spring’s force depends on both x1 and x2 .
4. Use Newton’s second law to write a second-order ODE for each mass.
144
CHAPTER 27. WEEK 11, CLASS 2: SYSTEMS OF 2ND-ORDER ODES
27.2
145
Mechanical System Frequency Response
We have looked at the equations of motion for two simple spring-mass systems (one and two masses). We
saw that when you have apmass with a spring alone, the solution to the equation of motion is an oscillatory
function with frequency k/m. This is referred to as the “natural frequency” of the spring-mass system.
When we add a damper, provided the system is underdamped, we have still seen oscillations, but at a
frequency shifted from the natural frequency.
In general, mechanical systems which are near an equilibrium can be characterized by one or more natural
frequencies (also known as eigenfrequencies as we will discuss below). The response of these mechanical
systems to an input which is oscillatory will often strongly depend on the frequency of that input. Here, we
are going to take a closer look at the solution for the two mass/three spring problem.
27.3
Eigenmodes of a Coupled Mass System
Let’s consider the case of two objects of equal mass m connected by a spring with spring constant k12 shown
in Figure 28.1. Each of these masses is also connected to a wall by a spring with spring constant k.
Figure 27.1: Coupled masses
First, double check your equations of motion found previously. The equations of motion which govern
the behavior of this system are:
m
d2 x1
= −kx1 − k12 (x1 − x2 )
dt2
(27.1)
m
d2 x2
= −kx2 − k12 (x2 − x1 )
dt2
(27.2)
146
CHAPTER 27. WEEK 11, CLASS 2: SYSTEMS OF 2ND-ORDER ODES
What are Eigenfrequencies and Eigenmodes?
Reference: A nice discussion of using eigenfrequencies for structural analysis, and a walk through of the
two-mass problem, is here.
An eigenfrequency is a certain frequency at which a system is prone to vibrate, also known as a natural
frequency. For each eigenfrequency in a system there is a corresponding eigenmode that describes the shape
of the oscillation.
So far we have studied systems with a single degree of freedom, e.g.
p the single spring-mass. In each
these cases, we found the natural frequency of the undamped systems
as
k/m. If you worked through the
p
pendulum chapter, you saw that it had a natural frequency of g/l.
For a multiple degree of freedom system, the number of eigenfrequencies is usually equal to the degrees
of freedom for the system (strictly speaking, equal to the rank of the mass matrix). For our system with two
masses and two springs, we have two degrees of freedom (x1 and x2 ), and expect two eigenfrequencies and
corresponding eigenmodes.
Thinking back to the Faces module, we showed how using eigenvalue decomposition allowed us to find
linearly independent components, or “building blocks,” of things like vectors and photographs. We can think
of the eigenfrequencies and eigenmodes of a mechanical system in a similar way. Every oscillation we see in
a multiple degree of freedom system is a linear combination of the principal eigenmodes. We will see this
physically later in the assignment and in the attached video.
Exercise 27.2
When analyzing systems with multiple degrees of freedom, it is often very helpful to write the
governing equations in matrix form:
MẌ + CẊ + KX = f (t)
In this matrix representation, we refer to M as the mass matrix, C as the damping matrix, and K as
the stiffness matrix. We have also included an external force term, f (t), which will be zero in this
course but will
play a key role
in the future
(e.g.,
in ESA). In our matrix representation, we also have
x1 (t)
ẋ1 (t)
ẍ1 (t)
X=
, Ẋ =
, and Ẍ =
.
x2 (t)
ẋ2 (t)
ẍ2 (t)
1. Write out the equations of motion for the two-mass system you found earlier in matrix form,
and identify the M, C, and K matrices. Hint: this is an undamped system, so you may have a
zero matrix.
We are going to assume that we can find a solution for this coupled set of second order differential
equations such that both masses are oscillating with the same frequency ω, but with different
amplitudes. We will assume trial solutions of the form x1 = B1 ejωt and x2 = B2 ejωt .
2. Plug the trial solutions for x1 and x2 into governing equations for the two masses, and show
you find two equations of the form:
(−mB1 ω 2 + kB1 + k12 B1 − k12 B2 )ejωt = 0
(−mB2 ω 2 + kB2 − k12 B1 + k12 B2 )ejiωt = 0
3. Show that the equations above can be written in matrix form below where b =
and B2 may be complex.
B1
and B1
B2
(−ω 2 M + K)bejωt = Zbejωt = 0
As you have seen previously in this course and back in QEA1, in order for this matrix equation to
have a nontrivial (not zero) solution for b, the determinant of Z must be zero.
CHAPTER 27. WEEK 11, CLASS 2: SYSTEMS OF 2ND-ORDER ODES
147
Note: To find eigenvalues we typically use the approach |A − λI| = 0. Looking at the Z matrix
you just wrote above, we see that λ = mω 2 , and our stiffness matrix K = A. So, we are solving an
eigenvalue problem when we find the four values of ω (eigenfrequencies) in the step below!
4. Use the fact that the determinant of Z must be zero, to solve for the four values of ω (given
below) in terms of the masses and spring constants of the system for which it is possible to
have nonzero amplitudes.
r
k
ω1,2 = ±
m
r
k + 2k12
ω3,4 = ±
m
As we discussed above, there is an eigenmode associated with each eigenfrequency, and these eigenmodes
describe the basic mode shape of the oscillation. The eigenmodes are given by the eigenvectors v that
correspond to the eigenfrequencies (eigenvalues) you just found. Recall that to find eigenvectors, we use the
fact that Av = λv or (A − λ1 I)v1 = 0.
Exercise 27.3
In the previous exercise, we noticed that the stiffness matrix K is equivalent to the matrix A in the
expressions Av = λv or (A − λ1 I)v1 = 0. We also noticed that λ = mω 2 . We can use these facts
to solve for the eigenmodes (eigenvectors) of the two-mass system.
1. Find the eigenmodes (eigenvectors) v which correspond to the eigenfrequencies (eigenvalues)
you just found. For examples, to find v1 , we would use the expression:
(K − λ1 )v1 = 0
where λ1 = mω1,2 2 = k
General Form of the Solution
The general solution for the system will be a superposition (sum) of all possible solutions with amplitudes
determined by the initial conditions. In this case, we have two eigenmodes, and each eigenfrequency can
appear either as positive or negative, hence there are four possible solutions and four initial conditions
needed to completely determine the system, as is appropriate for a system of two second order equations.
The general form of the solution below is messy, and can be simplified substantially recognizing that the
pairs C1 and C2 , and C3 and C4 must be complex conjugates to ensure x1 (t) and x2 (t) are real for all t.
For now, we are just interested in focusing on the eigenfrequencies and eigenmodes and what they mean
physically for the system. For an in-depth analysis of this problem, please see the reference here.
General Solution Form:
q
q
√ k 1
√ k 1
2k12 +k
2k12 +k
x1 (t)
t −1
j
t −1
−j
−j m
t
j m
t
m
m
= C1 e
+ C2 e
+ C3 e
+ C4 e
x2 (t)
1
1
1
1
Chapter 28
Week 12, Class 1: Bringing it all
together in the last day before break!
Learning Objectives
• Analyze a system of second order ODEs
• Find the eigenmodes for an oscillatory system and connect them to the physical motion of a
mechanical system.
• Compare experimental data to theoretical results using frequency domain analysis.
28.1
Mini Lecture: Overview of the two mass spring system
Figure 28.1: Coupled masses
28.2
Getting Real
We have some track and cart realizations of our two mass and spring system . There should be a few in each
room. The springs in these are all the same and there are a few extra springs and carts in each room.
Exercise 28.1
Review your notes from the last class and/or discuss the lecture material with your group. What are
the eigenfrequencies and eigenmodes of your system? How can you calculate them for your spring
mass system?
148
CHAPTER 28. WEEK 12, CLASS 1: BRINGING IT ALL TOGETHER IN THE LAST DAY BEFORE BREAK! 149
Exercise 28.2
1. Take one of the extra springs. Measure the spring constant of your springs (or look it up from
your past experiments).
2. Using the provided scale, weigh a cart to get the mass (or look it up from your past experiments).
3. Using one of the coupled mass setups, first play qualitatively with the carts. Can you give the
system initial conditions to get it to oscillate in one of the pure eigenmodes? Qualitatively,
how do the frequencies compare? What happens if you give it an initial condition which does
not match one or the other of the eigenmodes?
4. Given your spring constant and mass of the cart, calculate the frequencies that you expect to
see in the different eigenmodes. Does this match with what you observe?
5. Use two phones to collect some accelerometer data for both carts (you will need one phone for
each cart). Take note of your initial values for each cart. Choose some initial values that will
give you a MIXED MODE response.
6. Make sure you also weigh your phones so that you have all the values you need to analyze
your system.
28.3
Systems of Second Order ODEs - Analyzing Data
28.3.1
Experimental Data
A couple years ago, we used the accelerometers in a smartphone to record the motion of each cart in a
physical two-mass spring-cart setup in the QEA room. Your data might look different than ours, but for this
past physical setup, m1 = m2 = 0.648 kg, and k = k12 = 2.88 N/m. The mass given includes the cart and
the phone used to record the motion. You can use your data or follow along with ours.
Accelerometer Plots
Exercise 28.3
Below are some acceleration plots for the carts. The initial displacements of the two masses were
0.255m for cart 1 and 0.525m for cart 2.
1. What eigenmode(s) do you expect to be present given the initial conditions?
2. What would you expect an acceleration plot to look like for each cart? Do the plots match
your expectations?
3. Find the frequencies expected in the different eigenmodes.
4. Plot your own acceleration data from your experiment. How do they compare with ours?
What are your expected frequencies given your measurements of the spring constants, mass
of your phones, etc?
5. Use the fft to plot your acceleration data in the frequency domain. Do the peaks match what
you would expect?
CHAPTER 28. WEEK 12, CLASS 1: BRINGING IT ALL TOGETHER IN THE LAST DAY BEFORE BREAK! 150
Figure 28.2: Acceleration plots for cart 1.
Figure 28.3: Acceleration plots for cart 2.
Earlier we identified
for the system which
q
q two primary eigenfrequencies
k+2k12
k
correspond with the two eigenmodes: ω1,2 = ± m and ω3,4 = ±
. In the accelerometer plots
m
above, it is very hard to identify the frequencies of oscillation because this is a mixed mode motion. But, from
our general solution, we know that every motion solution should be a linear combination of the fundamental
eigenmodes:
q
q
√ k 1
√ k 1
2k12 +k
2k12 +k
x1 (t)
t −1
t −1
m
m
= C1 e−i m t
+ C2 ei m t
+ C3 e−i
+ C4 ei
x2 (t)
1
1
1
1
Frequency Domain Plots
When this experiment was conducted, m1 = m2 = 0.648 kg, and k = k12 = 2.88, which leads to
ω1,2 =2.07 rad/s or 0.33 Hz, and ω3,4 =3.6 rad/s or 0.57 Hz. Looking at the middle frame of each plot
(direction of motion), we see peaks in frequency at our eigenfrequencies!! In other words, we have shown
through experimentation that our math works! How cool is that!
CHAPTER 28. WEEK 12, CLASS 1: BRINGING IT ALL TOGETHER IN THE LAST DAY BEFORE BREAK! 151
Figure 28.4: Frequency domain plots for cart 1.
Figure 28.5: Frequency domain plots for cart 2.
28.3.2
Filtering
Exercise 28.4
We get some pretty clear peaks in our frequency data, but there’s still definitely some noise.
1. Do you think a filter is necessary here? What kind of filtering process would you use for this
data?
2. Optional Pick a technique from last week’s class and try it out. Plot your filtered results in the
frequency domain and in the time domain using your IFFT.
CHAPTER 28. WEEK 12, CLASS 1: BRINGING IT ALL TOGETHER IN THE LAST DAY BEFORE BREAK! 152
28.4
Synthesis: Putting it all Together
Exercise 28.5
1. With your group, please create a concept map of everything we’ve covered in QEA3 so far,
including math topics, physics topics, ODE applications, etc. Include your group’s concept
map with your submission.
2. Create a recipe for modeling and analyzing dynamic systems like our spring-mass-dampers.
What are some key questions, assumptions, and strategies to consider? Try to come up with a
recipe that would have been helpful in scenarios you have encountered and you will be able
to follow when confronted with new and challenging modeling scenarios. Create a concise
visual representation of the recipe (such as a flowchart) that you would want to refer to when
analyzing a new type of system.
3. Based on the concept map and recipe, identity which concepts and skills you are comfortable
with, and which you are still uncomfortable with or unsure about. If you have time, work
with your group to try to resolve uncertainty and ask an instructor/CA if you need help. For
this part, please submit a brief note on which concepts you would like more practice with
and how you intend to get that practice (e.g., office hours, apply in a project, find an external
resource...).
28.5
Additional Explanations and Resources
When we were forced to be remote, Jeff Dusek made an awesome video here describing the experiment and
its interpretation which you may want to check out after class.
28.6
Towards a Final Project - 20 min
Exercise 28.6
Read through the project descriptions with your table mates. Which are the most exciting to you?
Brainstorm a few ideas for open ended projects (options 1 and 2).
As you come up with ideas, you can put them in this google doc for ideation. You can see other
people’s ideas here as well, and use this as a tool to find potential group members!
Before you come back from Thanksgiving break on Monday 11/28, we would like you to sign up for
a project group on canvas. Groups should be 2-3 people.
28.6.1 Optional Exercise and Resources for Measuring and Interpreting Motion
(i.e. “Fitbit")
So far we’ve been using our second order ODEs and frequency domain analysis to analyze [fairly simple]
engineering systems like our spring-mass-dampers. One possible final project (and cool application of your
frequency domain analysys) is to use the fourier transform to analyze motion, particular motion of humans.
The "Fitbit" project is a final project option which focuses on using your engineering analysis skills to create
value for a user. Some previous projects are listed below. There are more in the project description.
• Dad Dancing
CHAPTER 28. WEEK 12, CLASS 1: BRINGING IT ALL TOGETHER IN THE LAST DAY BEFORE BREAK! 153
• Eigentricks
• Art Visualizer
The Sensor Coordinate System for a Smartphone For your reference, a diagram of the phone’s
coordinate system is shown in Figure 28.6 (both Android and iOS use the same convention).
Figure 28.6: Smartphone Coordinate System
Experiment Controls and Metronome Walking
In your experiments and analysis, it is almost always useful to have some kind of prediction for what your
data will look like. For our spring mass damper system, we were able to derive our equations of motion
and a general solution. This is much more complicated for the complex human motion that you might be
measuring in your "Fitbit" project. To check your experimental setup, it can be useful to have a "control"
experiment, for example, where you purposefully move at a set frequency, perhaps aided by a metronome.
In this experiment Jeff walked at a rate of 70 steps per minute while wearing the smartphone. The
smartphone was positioned at waist level at Jeff’s midline with the positive y-axis facing up, the positive
z-axis aligned with the direction of walking and the x-axis lateral to my body (e.g., pointing from hip to hip).
All code and data is available as a zip file.
Exercise 28.7
1. With your partners, come up with some hypotheses regarding the acceleration plots. You can
sketch the plots on the axes below or simply make a prediction about the shape and frequencies
that you might see.
CHAPTER 28. WEEK 12, CLASS 1: BRINGING IT ALL TOGETHER IN THE LAST DAY BEFORE BREAK! 154
2. Use the MATLAB code you downloaded earlier to visualize the accelerometer data. How does
the data compare to your expectations?
>> analyzeData('metronome_70bpm_phone_midline');
Exercise 28.8
1. Discuss the shape of each of the acceleration plots.
(a) How would you characterize the shape at a coarse level? What are some of the details of
the shape?
(b) What phenomena might these correspond to?
(c) Are there components of the data in the plot that you still can’t explain? What are they?
2. The data was collected by walking at 70 steps per minute. Does this match with the data in
each of the plots? Why or why not? You can use your fft to see if you have a peak at this value!
Chapter 29
Final Project Description
As you reach the end of your QEA journey, we want to provide you the opportunity and space to choose
your final grand adventure. To that end, the final project will have several options, each with a significant
level of flexibility. In all cases, we want you to focus on learning and/or applying quantitative tools. In
summary, the projects you can choose from include:
1. Creating Value by Analyzing Motion
2. Developing Insight by Analyzing Motion
3. ODE Textbook Study
4. The Synchronisation of Clocks
5. Propose your Own
29.1
Creating Value by Analyzing Motion
Learning Objectives
• Apply quantitative analysis skills to real-world value creation.
• Identify primary frequencies of motion through qualitative modeling and quantitative data
analysis.
• Extract value from measurements through digital filtering and spectral analysis.
• Effectively communicate analysis techniques and value creation through a website.
29.1.1
Overview
The development and miniaturization of sensors has led to an explosion in the application of wearable
sensing to the analysis and characterization of human behavior. Perhaps the most popular application of
these sensors is for fitness tracking (e.g., FitBit and smartphone activity trackers). However, these sensors
have been utilized for a wide array of applications, including early detection of disorders (e.g., Parkinson’s,
Dementia, Chronic Obstructive Pulmonary Disease), monitoring home rehabilitation (e.g., for home exercise
to alleviate low-back pain), navigation for people who are blind or visually-impaired, safety monitoring (e.g.,
fall detection, detection of epileptic seizures, etc.), and sleep monitoring (see the Resources section for links
to more examples).
Each of these applications can be characterized using a framework of value generation. Specifically, each
of the applications listed above has the following components.
155
CHAPTER 29. FINAL PROJECT DESCRIPTION
156
1. A person wearing the sensor (e.g., someone going for a run, a person in an eldercare facility,
someone at a rehab clinic).
2. A motion model that relates the application of interest to a meaningful understanding of the degrees
of freedom of the motion, the time derivatives of those degrees of freedom, and the expected frequency
of the motion. This model should also help inform the selection of appropriate sensor type and
sensing range. Your motion model could be a set of kinematic equations or it could simply be a set of
well-thought-out graphs that capture both qualitative and quantitative aspects of the motion.
3. A sensor (or sensor suite) (e.g., accelerometers, gyroscopes, GPS).
4. Algorithm(s) for analyzing raw sensor data to extract meaningful information and relate the
experimental data to the predictions from the motion model (e.g., falls, sleep quality).
5. An end user who derives value from the extracted information. The person wearing the sensor and
the end user could be the same person (as in the case of someone using a fitness tracker), or they could
be different (in the case of someone remotely monitoring a family member to detect whether their
loved one has fallen and become injured).
In this project you’ll be developing a proof-of-concept system that uses wearable sensing to
extract valuable information for a specific user group. You will have the freedom to choose your
specific user, application, and sensors subject to several requirements.
29.1.2
Project Requirements
Motion Model
For your chosen application, you must demonstrate an understanding of the dynamics of the underlying
motion. You will need to identify the degrees of freedom of the motion and think about the time derivatives
of position in each of those degrees of freedom. It will be very useful to sketch out predictions of these
quantities as a function of time, as it is important to know what you are expecting to see before collecting
experimental data. Thinking hard about your motion early in the development of your project will also help
in the selection of an appropriate sensor and inform where the sensor should be placed to maximize the
usefulness of collected data.
We want you to show that you have thought carefully about the motion, have an informed prediction
of what frequencies you expect to see in your experimental data, and understand what implications these
insights have on sensor selection and choice of analysis techniques. Your understanding of the motion can
be demonstrated through diagrams, sketches of your expectations for collected data, or a mathematical
equation (potentially implemented on a computer).
Just as in the design process, iteration is important in developing a useful motion model. Your motion
model provides an expectation for what experimental data should look like and helps identify and debug
sensor issues. Once you have collected quality experimental data, the motion model can be updated
and refined to better reflect the real world. Similarly, your data analysis will be developed based on the
expectations from your motion model and will be refined based on experimentation.
Example: It might be useful to read through section 5 of this solution from QEA II in 2018 that walks
through the analysis of accelerometer data captured on a bicycle.
Sensor Selection
We suggest that you use the sensors on a smartphone (iPhone or Android) for your project. The reasons
for this are many. For one, you’ve already had experience processing data from a smartphone earlier in
the module. Secondly, if you decide to pursue your project and develop it into an actual product you can
distribute it to a mass audience through either the Google Play Store of the iOS App Store. Thirdly, the
barriers to getting data from the sensors into an analysis platform, such as MATLAB, are minimal.
If you would like to use other sensing technology instead of (or in addition to) a smartphone we will
allow it, but only if you run it by one of the instructors on the teaching team. Here are some issues to
consider when choosing your own sensors.
CHAPTER 29. FINAL PROJECT DESCRIPTION
157
1. The sensors must be easily and quickly obtainable.
2. The data from the sensors must be easy to acquire. If the sensors require a lot of work just to get data
from them, then that will be taking away from doing meaningful analysis and design with the data.
3. You should be able to obtain synchronized data between all sensors easily. If you are using multiple
devices to collect data (e.g., an Arduino and a smartphone), you will face the challenge of synchronizing
the two sensor streams. Again, if this takes a significant amount of time you will be missing out on
other aspects of the project.
Signal Analysis Techniques
We want to you to maintain good alignment between the analysis techniques you have learned thus far
in this module (most notably Fourier analysis) and those that you will select for your project. Given the
open-ended nature of the project, it is of course likely that these two things will not be in complete alignment,
however, we are requiring you to use frequency domain analysis of your sensor data in at least one part of
your project. This analysis should consist of interpreting at least two frequencies related to the phenomenon
you are characterizing.
Value Creation
Your project should focus on extracting useful information from wearable sensors. You should define
usefulness in terms of a specific group of end users (e.g., physical therapists, people who are blind, people
with impaired sensing in their feet). You should be able to make a convincing argument as to how the system
you will develop creates value for these users.
29.1.3
Proof-of-Concept
This project is primarily about doing the experimentation, analysis, and design work to evaluate the feasibility
of the core of your proposed application, and communicating that work. Therefore, you should try to not
spend too much time on the finish and packaging that you would need for a fully realized system (e.g., user
interface, additional features). Remember, before you build something, you should evaluate whether or not it
is feasible. The focus of this project should be on making that feasibility determination and communicating
your findings.
29.1.4
(Some) Project Options
There are limitless options, but to help get you going, here are a few!
1. Distinguish two or more different types of activities or conditions for diagnosis based on frequency
spectrum data.
2. Create a monitoring system to help the user improve their general level of wellness (e.g., by exercising
more, getting more sleep).
3. Create a system to facilitate navigation for people who are blind or visually impaired.
4. Create a system to help train someone to be better at a sport.
5. Detect some sort of catastrophic event (e.g., a fall, a heart attack, etc.).
29.1.5
Deliverables
Detailed Project Proposal and Timeline [Due Monday, 11/28]
You and your partner will write up a project proposal including
• A description of your project idea and goals.
CHAPTER 29. FINAL PROJECT DESCRIPTION
158
• A discussion of how this project is connected to course material and other topics including the learning
you will need to do to complete this project.
• Outline of the quantitative analysis you will perform and the tools you will use for this analysis.
• A discussion of the learning objectives of the team members and how this project supports your
learning objectives.
• At least three references, ideally cited in your text to help support your project idea and proposed
analysis.
You will also create a detailed project timeline that includes major deliverables/events for other course/clubs,
and specifies contributions for each team member.
Project Consulting Days
While this is not a deliverable in the traditional sense, we are planning several in-class consulting days for
you to work on your projects. We expect you to have made significant progress on your project on each of
the two consulting days (i.e. you need to have done work outside of class). We expect you to come to the
consulting sessions with specific questions, graphs, analysis etc.
Website Pitch and Description [Due Final Event Period, Thursday, Dec. 15 at 8 am]
In lieu of a final report, you will design a website to describe your project. This website should describe the
overall idea of your project, the value it is intended to deliver and to whom, your system architecture, your
motion model and expectations for the experimental data, a description of any experiments you did (or data
you obtained), a detailed description of the analysis techniques you applied to your data, and the results of
applying these techniques and how the results aligned (or didn’t) with your predictions. Think of this as an
amazing kickstarter page (because it would actually include evidence of the technical analysis at the core of
the proof-of-concept) OR an awesome product description on a company website (see resources section for
examples).
You will be asked to give a short pitch of your project and website on the final day of the module. We
expect most of you to share the website on the screen and describe your project.
Feedback on your project and website will be based on the following criteria:
• Proof-of-Concept: The proof-of-concept should include a selection of sensors that are appropriate
for the specific application. The experiment(s) completed should demonstrate some aspect of how
the product would work in reality. Next steps for the proof-of concept (e.g., experiments, additional
sensors) should be well articulated.
• Value Creation: The proof-of-concept supports specific user groups in clearly defined ways. The
connection between the proof-of-concept and the user group is clear and built on existing research
and/or a strong understanding of particular areas of opportunity.
• Motion Model: Your motion model should demonstrate a clear understanding of the dynamics of your
motion, the degrees of freedom and their time derivatives, and the important frequencies. You should
explain how this model informed your data collection, and what, if any, modifications were made to
the model following experimentation.
• Algorithm Development: The algorithm(s) for data analysis should demonstrate a clear understanding
and application of Fourier analysis, the frequency domain, and motion model dynamics. The project
website should clearly explain the application of the algorithm to experimental data through the use of
appropriate equations and graphics. If any code is included in the website (and it does not have to be),
it should be presented professionally (no screenshots), explained clearly, and there should be a clear
rationale for including it; including a link to the code is fine if you wish to make it available to others.
• Overall Presentation and Delivery of Information: The website is professional, well-organized, and the
information is clear and easy to understand.
CHAPTER 29. FINAL PROJECT DESCRIPTION
159
Some examples of nicely done projects and websites from the last couple years of class can be found
below.
1. “ConductAid: Wearable devices assisting visually-impaired musicians.” (Nice description of the project
and algorithm. Some equations to help explain the approach would be useful.)
2. “Fidget Fighter” (Again would benefit from more information on the data analysis.)
3. “Dad Dancing”
4. “Eigentricks”
5. “Art Visualizer”
6. “PT Assist”
7. “Meditation Monitor”
8. “Longboard Dancing Trick Identifier”
9. “Remedy with a Melody”
29.1.6
Timeline
• 11/17-11/28: Project ideation and group formation
• 11/28: Project proposal due at end of class
• 12/8: Website workshop.
• 12/12: Project work day. Website draft due with technical analysis done.
• 12/15 (9 am): Final event. Website due and in-class presentation.
29.1.7
Resources
There are many papers that cover prior work on wearable sensing. Here are some places to start.
1. “A review of wearable sensors and systems with application in rehabilitation”
2. “Human Activity Recognition with Smartphones” (a Kaggle data science challenge).
3. “Assessment of spatio-temporal gait parameters from trunk accelerations during human walking.”
There are many more examples of product description websites and you should feel empowered to be as
creative as you would like with this. Just be sure to included the information described earlier in the Website
Pitch and Description section.
1. “imitone: mind to melody“
2. “OURA ring. Improve Sleep. Perform Better.“ (would have benefited from QEA level analysis on their
campaign page)
3. “Product Embrace“ (Again would benefit from more information on the data analysis)
CHAPTER 29. FINAL PROJECT DESCRIPTION
29.2
160
Developing Insight by Analyzing Motion
Rather than creating an application with value for a user, you could focus your project on developing
insight about an engineering system that moves or vibrates. Good examples might include the design of
earthquake-resilient homes, a vehicle (bicycle, car, motorcycle, etc) with a suspension system that will give a
safe and comfortable ride. You could look into the oscillations on 3D printers - how can you potentially get
better print quality by changing your print set-up? You could analyze oscillations and damping in the design
of a machine or robot you’ve made or are currently making (e.g. in PIE).
Your deliverables for this project are very similar to the "Creating Value Project." You should write a
project proposal and have a website or blog as a final deliverable showcasing your work. At minimum you
should have:
1. A motion model Your motion model could be a set of kinematic equations or it could simply be a set
of well-thought-out graphs and diagrams that capture both qualitative and quantitative aspects of the
motion. You should consider the natural oscillating frequencies of different parts of your system and
how they will effect its behavior. As in your solar house (where we put the house on stilts, made the
floor floating, assumed no storage in the walls, etc) it is ok to make assumptions that simplify your
model. These assumptions should be clearly outlined and supported by your analysis.
2. Data Collection and Experimental Analysis You should design some experiment(s) and gather
data on your system. We recommend that you at minimum use accelerometer data, but you can also
include gyroscopes, GPS, etc. Your analysis should include both the frequency domain and the time
domain, and you should compare your results with some expected predictions from your motion
model.
3. Design Recommendations You should present some final design recommendations for the system
that you choose.
29.3
ODE Textbook Study
Similar to the first project, this is an option to study material from the digital textbook called "Differential
Equations: A Toolbox for Modeling the World" by Kurt Bryan. You can find a purchased version of it here,
which you can access for occasional educational use: if you like the book we recommend you buy it.
The following chapter is relevant to us, and we have covered roughly the same material.
• Chapter 4: Second-Order Equations
In addition there are a couple of chapters that we have not covered in much or any detail. They are:
• Chapter 5: The Laplace Transform
This is a great chapter if you plan to take ESA in the future - you would enter that class
well-prepared.
• Chapter 7: Nonlinear Systems of Differential Equations
This is a great chapter if you want to round out your knowledge of ODEs and if you ever
wanted to take a course in Nonlinear Dynamics and Chaos
• Chapter 8: An Introduction to Partial Differential Equations
This is a great chapter if you plan to take PDEs in the future - you would enter that class
well-prepared.
In order to solidify and expand your knowledge, you could choose to read Chapter 4 from the book and
complete some exercises from each section. In addition, you would choose to study one of the other chapters
(5, 7, or 8) and learn new material. We expect that you will choose a substantial number of exercises and that
some of these will go into significant depth. You will be able to propose and get feedback on what set of
exercises you will complete. As your deliverable, you would turn in a detailed summary of the chapters and
answers to a selection of the exercises.
CHAPTER 29. FINAL PROJECT DESCRIPTION
29.4
161
The Synchronisation of Clocks
Christiaan Huygens invented the pendulum clock in 1657, and immediately set out to use them at sea in
order to keep track of longitude: this was one of THE technical challenges of the day. However, in 1665 he
reported a strange phenomenon in which two pendulum clocks, hanging side by side, swung in exactly the
same frequency and 180 degrees out of phase. The anti-phase behavior was robust: one of the pendulums
could be bumped and they would "synchronise" again in about one hour. Today, this phenomenon is more
broadly known as "The Synchronisation of Oscillators" and is the subject of much research.
In this project option, you will study in detail the paper Huygens Clocks, and replicate the findings.
This includes the underlying model, simulations, and experimental demonstration and measurement of this
phenomenon.
Download