Homework Solution
Homework Solution
Homework Solution
k
m
t) + cos(
k
m
t) cos(
k
m
t) and sin(
k
m
t)
3.19
Solution: Plug in t = 0 into x(t) to nd w
1
= 1
3.20
Solution: Plug in t = 0 into x(t) to nd w
2
= 0
3.21
Solution: From the previous two solutions we nd x(t) = cos(t)
3.22
Solution: Mass with only damping should decay without oscillations.
8
3.23
Solution: Mass with only spring should oscillate forever because no damping.
3.24
Solution: Without mass the system cannot oscillate so only the decay gure is plausi-
ble.
3.25
Solution: 4j
Inductors act like mass does in a mechanical system in that they add oscillation.
We know 4 +4j is not correct because the 4 indicates exponential growth and we cant
have growth (or decay without a resistor to provide damping).
3.26
Solution: Yes, because the system can be in equilibrium for the correct initial condi-
tions.
4 Homework 4
4.1
All are possible except the non-decaying, oscillating solution. Explanation as follows
Decaying: Represents a system that is overdamped, possible
Decaying and oscillating: Represents a system that is underdamped, possible
Pure oscillation: Impossible because the problem species that b is nonzero
therefore there must be some damping, impossible
Steady solution: This is an unknown system at equilibrium, possible
4.2
Answer is 2.
The differential equation for this system is given by
m v = kx kx bv bv
= 2kx 2bv.
If we assume an exponential solution of the standard form
x(t) = e
ht
w
9
and then plug this into the differential equation, we get
h
2
+
2b
m
h +
2k
m
e
ht
w = 0.
Since w = 0, we conclude the term in parenthesis must equal zero, and that we can
use the quadratic formula to solve this equation. We know that if the solution to this
equation has complex numbers the system response will oscillate, and if the solution
is real the response is just an exponential. Therefore, the part of the quadratic formula
under the square root sign tells us how to nd the critical value of b.
2
4 = 0
2b
m
2
4
2k
m
= 0
4b
2
16 = 0
b = 2
4.3
Answer is Decaying.
From Lecture 10,
h =
b
m
b
2
m
2
4
k
m
2
.
The part under the square root tells the characteristics of the solution.
b
2
m
2
4
k
m
=
4
2
2
2
4
1
2
= 4 2 = 2.
Thus the quadratic formula answers will both be real, and we have a decaying solution.
4.4
Answer is 0.0642
MATLAB Code:
% define parameters
k = 1;
m = 2;
b = 4;
dt = 0.01;
t0 = 0;
tf = 10.0;
% create arrays
10
tvec = t0:dt:tf;
xvec = zeros(length(tvec), 2);
xvec(1,:) = [1,0];
% Euler integration
for i = 1:length(tvec)-1
xvec(i+1, 1) = xvec(i, 2)
*
dt + xvec(i, 1);
xvec(i+1, 2) = (-k/m
*
xvec(i, 1) - b/m
*
xvec(i, 2))
*
dt ...
+ xvec(i, 2);
end
xvec(length(tvec), 1)
4.5
Answer is 0 g
4.6
The possible responses are pure oscillation, and no motion. No motion is possible if
the system starts at equilibrium. Both responses with decay are impossible. This can
be seen several ways:
This A matrix represents a mass-spring system with no damping, which implies
no decay
The eigenvalues of A are imaginary with zero for the real part which implies
pure oscillation
4.7
Answer is 6 6
The system has 6 states, thus A must be a 6 6 matrix.
4.8
Answer is 1 1
With given states and constants, the differential equation is
v = x v.
Thus in matrix form we have
x
v
0 1
1 1
x
v
A =
0 1
1 1
11
4.9
Answer is 4
We get 2 states from the mass and 1 state from each spring-damper shock.
4.10
Answer is Either are acceptable.
It is arbitrary which order we dene the states in matrix form.
4.11
Answer is 1
The second row of the given matrix must be the row corresponding to the distance
from the wall of the middle mass. Thus, the rst two values of 1 must be from spring
and damper attached to the wall, and the values X is from the spring to the right of
the mass. Its force direction is opposite of the other spring and the damper, thus its
coefcient is 1.
4.12
Answer is 0.030488
MATLAB Code:
%%%%%%%%%%%%%%%%%%
% PROBLEM SETUP %
%%%%%%%%%%%%%%%%%%
A = [0,1;-1,0];
dt = 0.1;
tf = 1.0;
w0 = [1; 0];
%%%%%%%%%%%%%%%%%%%%%%%%
% APPROXIMATE SOLUTION %
%%%%%%%%%%%%%%%%%%%%%%%%
% create arrays for solution
tvec = 0:dt:tf;
xvec = zeros(length(A), length(tvec));
% set initial conditions
xvec(:,1) = w0;
% use Euler integration to approximate
for i = 1:length(tvec)-1
xvec(:,i+1) = A
*
xvec(:,i)
*
dt + xvec(:,i);
end
12
%%%%%%%%%%%%%%%%%%%%%%%
% ANALYTICAL SOLUTION %
%%%%%%%%%%%%%%%%%%%%%%%
% first find eigenvalues and eigenvectors of A
[V,D] = eig(A);
w1 = V(:,1);
w2 = V(:,2);
h1 = D(1,1);
h2 = D(2,2);
% We know analytical solution can be written as a linear
% combination of eigenvector/eigenvalue pairs. So we need
% to solve for a multiplier for each exponential solution
% given by the eig pairs. We use the initial conditions to
% get these multipliers.
mults = V\w0;
xana = mults(1)
*
w1
*
exp(h1
*
tvec) + mults(2)
*
w2
*
exp(h2
*
tvec);
%%%%%%%%%%%%%%%%%%%
% CALCULATE ERROR %
%%%%%%%%%%%%%%%%%%%
disp([Error = , num2str(abs(xana(1,length(tvec)) - ...
xvec(1,length(tvec))))])
plot(tvec, xvec(1,:), tvec, xana(1,:))
4.13
Answer is 0.0
MATLAB code:
A = [0,1; -1,0];
eig(A)
4.14
Answer is the spring-mass system
Purely imaginary eigenvalues represent non-decaying, oscillating solutions. This is the
only system that can exhibit this behavior. Additionally, none of the other systems can
be the correct one given the following reasoning:
Spring-damper system System only has 1 state, so given A is the wrong dimen-
sion
Mass-damper system Given A matrix has a 1 multiplying a position state,
thus there must be a spring
13
Spring-mass-damper system This systems A would have numbers in both en-
tries of the bottom row
4.15
Answer is 1
If there was more than 1 mass, we would need more than 3 states, and this A implies
that we have 3 states.
4.16
Answer is the system with the unconnected mass.
If we dene x
1
to be the position of the spring, and we dene x
2
to be the distance
from the wall to the mass, we have the following differential equations
x
1
=
k
b
x
1
m x
2
= 0
Note that then second equation can be divided by m to become x
2
= 0. We can then
put this in matrix form as
x
1
x
2
v
2
k/b 0 0
0 0 1
0 0 0
x
1
x
2
v
2
this matches the form of the given A, thus it is the correct system.
4.17
Answer is 0.38 2.62
MATLAB Code:
m = 1;
k = 1;
b = 3;
A = [0,1;-k/m,-b/m];
[V,D] = eig(A);
% get eigenvalues
lam1 = D(1,1)
lam2 = D(2,2)
% get and re-scale eigenvectors to ensure that second entry
is 1 like in the problem:
v1 = V(:,1);
14
v2 = V(:,2);
v1 = v1
*
1/v1(2)
v2 = v2
*
1/v2(2)
4.18
Answer is given by
e
0.38t
2.62
1
e
2.62t
0.38
1
2.62
1
0.38
1
3
2
which is the given initial condition. Thus the correct solution is the negative sum of the
two exponential eigenvalue-eigenvector solutions.
4.19
Answer is 0.6562
Differential equation is given by
v =
2k
m
x
which in matrix form is
x
v
0 1
2k/m 0
x
v
y
1
y
2
v
1
v
2
0 0 1 0
0 0 0 1
k/m k/m 0 0
k/m k/m 0 0
y
1
y
2
v
1
v
2
y
1
y
2
v
1
v
2
0 0 1 0
0 0 0 1
k/m k/m 0 0
k/m k/m 0 0
y
1
y
2
v
1
v
2
4Dt
e
(x0.5)
2
4Dt
+ 0.25
1
4Dt
e
(x0.7)
2
4Dt
6.2 Problem 2
Solution: The diffusion equation is linear, so superposition applies and we can add
solutions.
6.3 Problem 3
Solution: The concave parabolic plot.
After a few milliseconds the two Gaussians representing the concentration of each
die meet to make a single concave Guassian looking function.
Matlab Code:
>> C = @(x, t, A, D, x0) A 1/sqrt(4 pi D t) exp((x x0)
2
/(4 D t))
>> Cprob = @(x) C(x, 1, 0.75, 1, 0.5) + C(x, 1, 0.25, 1, 0.7)
>> X = [0 : 0.01 : 1]
>> y = arrayfun(Cprob, X)
6.4 Problem 4
Solution: 0.28
Matlab Code:
>> C = @(x, t, A, D, x0) A 1/sqrt(4 pi D t) exp((x x0)
2
/(4 D t))
>> C(0.4, 1, 0.75, 1, 0.5) + C(0.4, 1, 0.25, 1, 0.7)
19
Matlab Code:
>> clear all
>> t0 = 0.0;
>> tf = 10.0;
>> dt = 0.01;
>> k = 1.0;
>> b = 0;
>> m = 1.0;
>> x0 = 0; x0dot = 0;
>> tvec = [0 : dt : tf];
>> xvec(:, 1) = [x0; x0dot];
>> A = [0, 1; k/m, b/m];
>> B = [0; 1];
>> u = sin(tvec);
>> for i = 1 : (length(tvec) 1)
>> xvec(:, i + 1) = xvec(:, i) + (A xvec(:, i) + B u(i)) dt;
>> end
>> xvec(:, tvec == 1)
>> plot(tvec, xvec(1, :), b)
6.5 Problem 5
Solution: 0.147
6.6 Problem 6
Solution: 0.321
6.7 Problem 7
Solution: 1.11
20
Using convolution we can add the solution of Question 5 to the 3 times the solu-
tion to question 6 to get the solution to this question. You can verify this using Euler
integration.
6.8 Problem 8
Solution: 0.543
6.9 Problem 9
Solution: 1.653
Using convolution we can add the solution of Question 7 to the solution to Question
8 to get the solution to this question. You can verify this using Euler integration.
6.10 Problem 10
Solution: C
1
+ C
2
Use the fact that V =
1
C
i for each capacitor and the fact that i
C1
+ i
C2
= i
C
6.11 Problem 11
Solution: Plot of step function with two at lines.
Remember that when the switch is closed, the voltage law has to be instantly satis-
ed.
21