Theory of Oscillations
Part 3: Plots of Solutions
Alexei V. Tikhonenko
Email: avtikhon@okclub.org
General Physics Department, Institute of Nuclear Power Engineering, Russia
This worksheet demonstrates the use of Maple for the numerical solution of equations of oscillation and illustrates how to use "DEtools" and "plots" for the visualization of solutions.
Introduction
DEtools Package and plots Package
| > | restart; with(DEtools): with(plots): |
Warning, the name changecoords has been redefined
Examples
Consider some examples of solutions for oscillatory systems with fixed parameters and initial conditions.
1) Free damped oscillator .
This oscillator is characterized by the frequency
,
damping factor
g
and initial conditions
.
2) Forced damped oscillator I .
This oscillator is characterized by the
frequency
,
damping factor
g
,
amplitude of external force
,
frequency
of external force and initial conditions
I
.
3) Forced damped oscillator II .
This oscillator is characterized by the
frequency
,
damping factor
g
,
amplitude of external force
,
frequency
of external force and initial condition
s
II.
4) Forced damped oscillator III .
This oscillator is characterized by
the
frequency
,
damping factor
g
,
amplitude of external force
,
frequency
of external force which is equal to the frequency of damped
oscillation
and initial condition
s
III.
5) Forced undamped oscillator IV .
This oscillator is characterized by the frequency
,
damping factor
g
,
amplitude of external force
,
the frequency
of external force which is equal to resonance frequency and initial condition
s
IV.
Section 3.1. FREE DAMPED OSCILLATOR
Consider the free damped oscillator. The equation of oscillation and initial conditions in this situation take the forms:
where x(t) is the oscillation variable,
is the frequency, and
g
is the damping factor.
MAPLE expressions for
- fixed parameters,
- initial conditions,
- frequency of damped oscillation,
- amplitude of free undamped oscillation;
- differential equation of oscillation,
- resulting analytical solution,
- plot
are:
| > | omega0:=4; gamma0:=1/2; x0:=7/4; v0:=3; omega1:=sqrt(omega0^2-gamma0^2); Amp:=sqrt(x0^2+(v0/omega0)^2); Eqn_01:=diff(x(t),t,t)+2*gamma0*diff(x(t),t)+omega0^2*x(t)=0; sol_01:=dsolve( {Eqn_01,x(0)= x0,D(x)(0)=v0}, x(t)); plot( rhs(sol_01), t=0..15); |
Resulting solution contains products of harmonic functions with the frequency of damped oscillation w1 and exponential functions:
| > | x_01_harm1(t):=sin(3/2*sqrt(7)*t); x_01_harm2(t):=cos(3/2*sqrt(7)*t); x_01_exp(t):=exp(-1/2*t); |
Plots of these functions are:
| > | plot([x_01_harm1(t),x_01_harm2(t), x_01_exp(t)], t=0..15,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[2,2,2]); |
Product of the amplitude of oscillation Amp and the decreasing exponential function is the envelope curve for the the resulting solution x_01(t):
| > | rhs(sol_01); Amp*x_01_exp(t);-Amp*x_01_exp(t); |
| > | plot([rhs(sol_01),Amp*x_01_exp(t),-Amp*x_01_exp(t)], t=0..15, linestyle=[1,3,3], color=[red,blue,blue],thickness=[3,2,2]); |
Now we can compare solutions for the damped and undamped oscillations. Solution for the undamped oscillations we can obtain as follows:
| > | Eqn_01:=diff(x(t),t,t)+omega0^2*x(t)=0; sol_01_UD:=dsolve( {Eqn_01,x(0)= x0,D(x)(0)=v0}, x(t)); |
| > | plot([rhs(sol_01),rhs(sol_01_UD)],t=0..15,linestyle=[1,3],color=[red,blue],thickness=[3,2]); plot([rhs(sol_01),rhs(sol_01_UD)],t=0..2.1,linestyle=[1,3],color=[red,blue],thickness=[3,2]); |
The first plot demonstrates the decreasing of damped oscillations in comparison with undamped oscillations.
The last plot demonstrates the difference of frequencies (and periods) of undamped and damped oscillations, too: the period of undamped oscillations is greater than the period of damped oscillations.
Section 3.2. FORCED DAMPED OSCILLATOR I
Consider the forced damped oscillator. The equation of oscillation and initial conditions in this situation take the forms:
where x(t) is the oscillation variable and f0 is the amplitude of the external force.
MAPLE expressions for
- fixed parameters,
- initial conditions,
- frequency of damped oscillation,
- frequency of external force,
- amplitude of external force,
- differential equation of oscillation,
- resulting analytical solution,
- plot
are:
| > | omega0:=2; gamma0:=7/20; x0:=2; v0:=0; omega1:=sqrt(omega0^2-gamma0^2); f_02:=4; Omega:=3; Eqn_02:=diff(x(t),t,t)+2*gamma0*diff(x(t),t)+omega0^2*x(t)=f_02*cos(Omega*t); sol_02:=dsolve( {Eqn_02,x(0)= x0,D(x)(0)=v0}, x(t)); plot( rhs(sol_02), t=0..30); |
This solution contains products of harmonic and exponential functions:
| > | x_02_harm1(t):=sin(1/20*sqrt(1551)*t); x_02_harm2(t):=cos(1/20*sqrt(1551)*t); x_02_exp(t):=exp(-7/20*t); x_02_reg1(t):=sin(3*t); x_02_reg2(t):=cos(3*t); |
Plots of these functions are:
| > | plot([x_02_harm1(t),x_02_harm2(t), x_02_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[1,1,1]); plot([x_02_reg1(t),x_02_reg2(t), x_02_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[1,1,1]); |
Solution x_02(t) is the superposition of damped oscillation and forced oscillation:
where
| > | x_02_pr(t):=434/414681*exp(-7/20*t)*sin(1/20*sqrt(1551)*t)*sqrt(1551)+7882/2941*exp(-7/20*t)*cos(1/20*sqrt(1551)*t); x_02_reg(t):=840/2941*sin(3*t)-2000/2941*cos(3*t); plot([rhs(sol_02), x_02_pr(t),x_02_reg(t)], t=0..25, linestyle=[1,3,4], color=[gold,blue, magenta]); |
Plots of the resulting solution x_02(t) and x_02_pr(t) show the presence of transitional and steady state oscillations. Steady state corresponds to damping of oscillation of the system.
The product of the amplitude A_pr and the decreasing exponential function is the envelope curve for the resulting solution x_02(t)
| > | A_pr:=eval(subs(t=0, x_02_pr(t))): plot([x_02_pr(t),A_pr*x_02_exp(t),-A_pr*x_02_exp(t)], t=0..25, linestyle=[1,3,3], color=[red,blue,blue],thickness=[3,1,1]); |
The next plot demostrates the resulting solution x_02(t):
a) the steady state of oscillation corresponds to damping of oscillation,
| > | plot([rhs(sol_02),A_pr*x_02_exp(t),-A_pr*x_02_exp(t), x_02_pr(t)], t=0..25,linestyle=[1,3,3,3],color=[gold,blue,blue,magenta],thickness=[3,1,1,2]); |
b) in the steady state, the resulting solution differs from the external force by the constant phase f :
| > | phi:=Pi-arctan(840/2000); phi:=evalhf(Pi-arctan(840/2000)); |
This value of the phase is nearly to value of p . Therefore during steady state resulting solution is almost in reversed phase to external force:
| > | plot([rhs(sol_02),A_pr*x_02_exp(t),-A_pr*x_02_exp(t),f_02*cos(Omega*t)], t=0..25,linestyle=[1,3,3,1],color=[gold,blue,blue,magenta],thickness=[3,1,1,1]); |
Section 3.3. FORCED UNDAMPED OSCILLATOR
Consider the forced damped oscillator with null initial position and velocity and external force with frequency equal to the resonance frequency. The equations of the oscillation take the forms:
where x(t) is the oscillation variable,
is the frequency,
g
is damping factor,
is the frequency of external force,
f0
is the amplitude of external force and
is the resonance frequency.
MAPLE expressions for
- fixed parameters,
- initial conditions,
- frequency of damped oscillation,
- frequency of external force (resonance frequency),
- amplitude of damped oscillation,
- differential equation of oscillation,
- resulting analytical solution,
- plot
are:
| > | omega0:=5; gamma0:=1/4; x0:=0; v0:=0; omega1:=sqrt(omega0^2-gamma0^2); f_03:=4; Omega1:=sqrt(omega0^2-2*gamma0^2); Eqn_03:=diff(x(t),t,t)+2*gamma0*diff(x(t),t)+omega0^2*x(t)=f_03*cos(Omega1*t); sol_03:=dsolve( {Eqn_03,x(0)= x0,D(x)(0)=v0}, x(t)); plot(rhs(sol_03), t=0..25); |
The above solution contains products of harmonic and exponential functions and harmonic function corresponding to steady state of oscillation
| > | x_03_harm1(t):=sin(1/4*sqrt(399)*t); x_03_harm2(t):=cos(1/4*sqrt(399)*t); x_03_exp(t):=exp(-1/4*t); x_03_reg1(t):=sin(1/4*399^(1/2)*t); x_03_reg2(t):=cos(1/4*399^(1/2)*t); |
Plots of these functions are:
| > | plot([x_03_harm1(t),x_03_harm2(t), x_03_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[1,1,1]); plot([x_03_reg1(t),x_03_reg2(t), x_03_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[1,1,1]); |
Solution x_03(t) is the superposition of damped oscillation and forced oscillation:
where
| > | x_03_pr(t):=-32/399*exp(-1/4*t)*sin(1/4*399^(1/2)*t)*399^(1/2)-32/399*exp(-1/4*t)*cos(1/4*399^(1/2)*t); x_03_reg(t):=32/399*sin(1/4*398^(1/2)*t)*398^(1/2)+32/399*cos(1/4*398^(1/2)*t); plot([rhs(sol_03), x_03_pr(t),x_03_reg(t)], t=0..20, color=[gold,blue, magenta],thickness=[3,2,1]); |
Plots of the resulting solution x_03(t) and x_03_pr(t) show presence of transitional and steady state of oscillation. Steady state corresponds to damping of oscillation of the system.
The product of the amplitude A_pr and the decreasing exponential function is the envelope curve for the resulting solution x_03(t)
| > | A_pr:=((32/399)^2+((-32/399)*sqrt(399))^2)^(1/2): plot([x_03_pr(t),A_pr*x_03_exp(t),-A_pr*x_03_exp(t)], t=0..25, linestyle=[1,3,3], color=[red,blue,blue],thickness=[3,1,1]); |
The next plot demonstrates the resulting solution x_03(t):
a) steady state of oscillation corresponds to the damping of oscillation,
| > | plot([rhs(sol_03),A_pr*x_03_exp(t),-A_pr*x_03_exp(t), x_03_pr(t)], t=0..25,linestyle=[1,3,3,3],color=[gold,blue,blue,magenta],thickness=[3,1,1,2]); |
b) if the product of the amplitude A_pr and the decreasing exponential function
are envelope curves for the solution, then the functions
are envelope curves for the resulting forced solution x_03(t)
| > | plot([rhs(sol_03),A_pr*(1-x_03_exp(t)),-A_pr*(1-x_03_exp(t))], t=0..25,linestyle=[1,3,3],color=[gold,blue,blue],thickness=[3,1,1]); |
This value of the phase is nearly to value of pi/2 . Therefore, during steady state, the resulting solution is out-of-phase with the external force by almost pi/2 :
| > | plot([rhs(sol_03),A_pr*x_03_exp(t),-A_pr*x_03_exp(t),f_03*cos(Omega1*t)], t=0..25,linestyle=[1,3,3,1],color=[gold,blue,blue,magenta],thickness=[3,1,1,1]); |
Section 3.4. FORCED DAMPED OSCILLATOR
Consider the forced damped oscillator with null initial position and external force with frequency equal to the resonance frequency. The equations of oscillation in this situation take the forms:
where
is the resonance frequency.
MAPLE expression for
- fixed parameters,
- initial conditions,
- frequency of damped oscillation,
- frequency of external force (resonance frequency) ,
- amplitude of damped oscillation,
- differential equation of oscillation,
- resulting analytical solution,
- plot
are:
| > | omega0:=5; gamma0:=1/4; x0:=0; v0:=22; omega1:=sqrt(omega0^2-gamma0^2); f_04:=4; Omega1:=sqrt(omega0^2-2*gamma0^2); Eqn_04:=diff(x(t),t,t)+2*gamma0*diff(x(t),t)+omega0^2*x(t)=f_04*cos(Omega1*t); sol_04:=dsolve( {Eqn_04,x(0)= x0,D(x)(0)=v0}, x(t)); plot(rhs(sol_04), t=0..25); |
The resulting solution contains products of harmonic and exponential functions and harmonic functions corresponding to the steady state:
| > | x_04_harm1(t):=sin(1/4*sqrt(399)*t); x_04_harm2(t):=cos(1/4*sqrt(399)*t); x_04_exp(t):=exp(-1/4*t); x_04_reg1(t):=sin(1/4*sqrt(398)*t); x_04_reg2(t):=cos(1/4*sqrt(398)*t); |
Plots of these functions are:
| > | plot([x_04_harm1(t),x_04_harm2(t), x_04_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[1,1,1]); plot([x_04_reg1(t),x_04_reg2(t), x_04_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta], thickness=[1,1,1]); |
Solution x_04(t) is the superposition of damped oscillation and forced oscillation:
where
| > | x_04_pr(t):=8/57*exp(-1/4*t)*sin(1/4*sqrt(399)*t)*sqrt(399)-32/399*exp(-1/4*t)*cos(1/4*sqrt(399)*t); x_04_reg(t):=32/399*sin(1/4*398^(1/2)*t)*398^(1/2)+32/399*cos(1/4*398^(1/2)*t); plot([rhs(sol_04), x_04_pr(t),x_04_reg(t)], t=0..25, color=[gold,blue, magenta]); |
Plots of the resulting solution x_04(t) and x_04_pr(t) show the presence of transitional and steady state oscillations.
The product of the amplitude A_pr and the decreasing exponential function is the envelope curve for the resulting solution x_04(t)
| > | A_pr:=(((8/57)*sqrt(399))^2+(32/399)^2)^(1/2): plot([x_04_pr(t),A_pr*x_04_exp(t),-A_pr*x_04_exp(t)], t=0..25, linestyle=[1,3,3], color=[red,blue,blue],thickness=[3,1,1]); |
Next plot demonstrates resulting solution x_04(t):
a) steady state of oscillation corresponds to damping of oscillation,
| > | plot([rhs(sol_04),A_pr*x_04_exp(t),-A_pr*x_04_exp(t), x_04_pr(t)], t=0..25,linestyle=[1,3,3,3],color=[gold,blue,blue,magenta],thickness=[3,1,1,2]); |
b) if the product of the amplitude A_pr and the decreasing exponential function
are envelope curves for the solution, then the functions
are envelope curves for the resulting forced solution x_03(t) ( A_pr is the amplitude of the oscillation, A_reg is the amplitude oscillation during steady state):
| > | A_reg:=sqrt((32/399*sqrt(398))^2+(32/399)^2): plot([rhs(sol_04),A_pr*(x_04_exp(t))+A_reg,-A_pr*(x_04_exp(t))-A_reg], t=0..25,linestyle=[1,3,3],color=[gold,blue,blue],thickness=[3,1,1]); |
c) during steady state resulting solution differs from external force by a constant phase:
This value of the phase is nearly to value of pi/2. Therefore during steady state resulting solution is out-of-phase with the external force by almost pi/2:
| > | plot([rhs(sol_04),A_pr*x_04_exp(t)+A_reg,-A_pr*x_04_exp(t)-A_reg,f_04*cos(Omega1*t)], t=0..25,linestyle=[1,3,3,1],color=[gold,blue,blue,magenta],thickness=[3,1,1,1]); |
Section 3.5. FORCED DAMPED OSCILLATOR
Consider the forced damped oscillator with null initial position and external force with frequency equal to the resonance frequency. The equations of oscillation take the forms:
where
is the resonance frequency.
MAPLE expressions for
- fixed parameters,
- initial conditions,
- frequency of damped oscillation,
- frequency of external force (resonance frequency),
- amplitude of damped oscillation,
- differential equation of oscillation,
- resulting analytical solution,
- plot
are:
| > | omega0:=5; gamma0:=1/4; x0:=4; v0:=0; omega1:=sqrt(omega0^2-gamma0^2); f_05:=4; Omega1:=sqrt(omega0^2-2*gamma0^2); Eqn_05:=diff(x(t),t,t)+2*gamma0*diff(x(t),t)+omega0^2*x(t)=f_05*cos(Omega1*t); sol_05:=dsolve( {Eqn_05,x(0)= x0,D(x)(0)=v0}, x(t)); plot(rhs(sol_05), t=0..25); |
Resulting solution contains products of harmonic and exponential functions:
| > | x_05_harm1(t):=sin(1/4*sqrt(399)*t); x_05_harm2(t):=cos(1/4*sqrt(399)*t); x_05_exp(t):=exp(-1/4*t); x_05_reg1(t):=sin(1/4*398^(1/2)*t); x_05_reg2(t):=cos(1/4*398^(1/2)*t); |
Plots of these functions are:
| > | plot([x_05_harm1(t),x_05_harm2(t), x_05_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta]); plot([x_05_reg1(t),x_05_reg2(t), x_05_exp(t)], t=0..25,linestyle=[1,1,3],color=[red,blue,magenta]); |
The solution x_05(t) is the superposition of damped and forced oscillation:
Plots of the resulting solution x_05(t) and x_05_pr(t) show the presence of transitional and steady state oscillation.
The product of the amplitude A_pr and the decreasing exponential function is the envelope curve for the resulting solution x_05(t)
| > | x_05_pr(t):=-4/57*exp(-1/4*t)*sin(1/4*399^(1/2)*t)*399^(1/2)+1564/399*exp(-1/4*t)*cos(1/4*399^(1/2)*t); x_05_reg(t):=32/399*sin(1/4*398^(1/2)*t)*398^(1/2)+32/399*cos(1/4*398^(1/2)*t); |
| > | A_pr:=sqrt((((4/57)*sqrt(399))^2+(1564/399)^2)): plot([x_05_pr(t),A_pr*x_05_exp(t),-A_pr*x_05_exp(t)], t=0..25, linestyle=[1,3,3], color=[red,blue,blue],thickness=[3,1,1]); |
Next plot demonstrates the resulting solution x_04(t):
a) steady state of oscillation corresponds to damping of oscillation,
| > | plot([rhs(sol_05),A_pr*x_05_exp(t),-A_pr*x_05_exp(t), x_05_pr(t)], t=0..25,linestyle=[1,3,3,3],color=[gold,blue,blue,magenta],thickness=[3,1,1,2]); |
b) during steady state, the resulting solution differs from the external force by a constant phase:
This value of the phase is nearly to value of pi/2 . Therefore, during steady state, the resulting solution is out-of-phase with the external force by almost pi/2 :
| > | plot([rhs(sol_05),f_05*cos(Omega1*t)],t=0..25,linestyle=[1,1],color=[gold,magenta],thickness=[3,1]); |
| > |
© 2002. Alexei V. Tikhonenko