Harmonic Oscillators with Piecewise Constant Forcings The forced harmonic oscillator, by ky

advertisement
Harmonic Oscillators with Piecewise Constant Forcings
The forced harmonic oscillator,
my 00 + by 0 + ky = f (t), y(0) = y0 , y 0 (0) = y00
(1)
is equivalent to the first order system (x1 = y, x2 = y 0 , x = [x1 , x2 ]T ),
x0 = Ax + f (t),
where



(2)

q
0
1 
0

 , and ω = k/m, γ = b/m.
A=
,
f
(t)
=
−ω 2 −γ
f (t)/m
Assume first that f (t) = f0 = const. It is easy to see that a particular solution for this forcing is
given by xp = [f0 /mω 2 , 0]T . Adding the general solution of the homogeneous system and matching
to the initial condition leads to the following solution of (2),

x(t) = 
2


2

f0 /mω 
f0 /mω 
).
+ eAt (x0 − 
0
0
This formula can be extended to piecewise constant forcings. Assume
f (t) = fn = const if nh < t < (n + 1)h, n = 0, 1, 2, . . . ,
where h > 0. One can step from one constancy interval to the other by applying the above formula
with initial condition at the left end of an interval given by the solution at the right end of the
preceding interval. In this way, x(t) will be represented by a sequence xn (t) (n = 0, 1, 2, . . .) of
solutions, valid in the range nh ≤ t ≤ (n + 1)h. The xn (t) are defined recursively as
xn (t) = xp,n + eA(t−nh) (xn−1 (nh) − xp,n ), n = 0, 1, 2, . . . ,
where x−1 (0) = x0 , and

xp,n
(3)

fn /mω 2 
=
0
is the particular solution in the respective interval.
These formulae also provide a method for approximating the solution of (1) for arbitrary
continuous forcing f (t). One can choose a sufficiently small stepsize h, and represent f (t) in each
interval by its mean value at the left and right ends. Denote this piecwise constant approximation
of f (t) by fp (t). Denote further the solution of (1) for the continuous f (t) by yc (t), and the
solution with f (t) replaced by fp (t) by yp (t). The figures on the next page (generated by the
Matlab function piecewise.m, which is called in the script file pwscript.m) show and compare these
functions for
f (t) = sin t, m = b = k = 1, y(0) = y 0 (0) = 0, h = 0.5.
forcing f(t)=sin(t) and piecewise constant approximation f (t)
p
1
1
0.8
0.5
fp
0.6
0
0.4
−0.5
0.2
−0.2
1
−0.4
0.5
yp
f
−1
0
5
−0.6
−0.8
−1
10
t
0
15
solution yp(t) for a piecewise constant approximated sine
0
−0.5
0
2
4
6
8
10
12
14
−1
16
t
yp(t) and yc(t)
1.5
0
5
10
t
15
1
0.5
yc(t)
0
f
1
−0.5
0.5
0
2
4
0
y (t)
p
6
8
t
10
12
14
16
12
14
16
solution yc(t) for a sine force
1.5
1
−0.5
0.5
yc
y
−1
−1
0
−0.5
−1
−1.5
−1.5
0
2
4
6
t
8
10
12
14
16
0
2
4
6
8
10
t
Download