The solution of differential equation of physical
problem by the use of Matlab
Erika Fechová
Technical University of Košice, Faculty of Manufacturing Technologies of the Technical
University of Košice with a seat in Prešov, Department of Informatics, Mathematics and
Cybernetics
e-mail: [Link]@[Link]
Abstract
At the present time teachers try to introduce and use information technologies in educational
process of technical subjects at schools as mathematics, physics, chemistry. Apart from e-
learning support (electronic materials and textbooks available on the internet), there are
various mathematical software environments as Matlab, Mathematica, MS Excel etc. The
paper points out the possibility of Matlab utilization at solving differential equation of
physical problem.
1. Introduction
Physical problem provides knowledge in various forms – as a means of motivation,
information about examined phenomenon, but also as a set of functions needed for the
solution of the problem. A student – solutionist of physical problem – has to carry out
a certain program consisting of partial functions - steps [1]. Creation of mathematical models
of physical phenomena is an important part of physical problems solution. Modelling is one of
theoretical cognitive methods whose characteristic feature is cognitive process, in which
examined phenomenon – an original cognitive object – is replaced by a model cognitive
object – a model. Under the term of mathematical model is understood a sum of mathematical
relations capable of quantitative description of physical phenomenon. Mathematical model is
an abstraction and idealization of real phenomenon [2]. Model has to be created as
a functional one. Functionality of model is estimated according to its behavior at the change
of conditions, at which it works. The form of mathematical model depends on used
mathematical tools. Mathematical model of physical problem solved within the subject of
Physics of bachelor´s studies at the Faculty of Manufacturing Technologies of the Technical
University of Košice with a seat in Prešov is presented in the following part of the paper.
2. The solution of physical problem
Assignment: Steel cannonball with the r radius and ρ density is fired with the initial
velocity v0 from the cannon of the Coast Artillery under an α angle. Determine the length of
cannonball firing range. Solve the problem for numerical values: α = 45o , r = 0,05m ,
ρ = 7800kg.m −3 , v0 = 1000m.s −1 , c = 0,26kg.m −1 .
Solution: The solution of the problem is based on the fact that the cannonball carries out
curvilinear motion in the gravitational field of the Earth that is called projection at an angle. It
is the motion consisting of two motions: uniform motion and vertical throw upward with the
initial velocity v0 (fig. 1).
Figure 1. The motion of cannonball.
We proceed from the balance of forces to make out equations. For the balance of forces at the
2
d 2x dx
direction of x axis is valid: Fx + Fox = 0 ⇔ m 2 + cS = 0 , where Fx is the power
dt dt
of acceleration at the direction of x axis according to the Newton´s second law, Fox is the
resistance power at the direction of x axis, c is the coefficient of aerodynamic resistance of
the cannonball, S is the frontal area of the shot. For the balance of forces at the direction of
2
d2y dy
y axis is valid: F y + Foy + Fg = 0 ⇔ m + cS = − mg , where Fy is the power of
dt 2 dt
acceleration at the direction of y axis according to the Newton´s second law, Fg is the
gravitation force, Foy is the resistance power at the direction of y axis, c is the coefficient of
aerodynamic resistance of the cannonball, S is the frontal area of the shot.
The system of two differential equations of the second order without or with the second
member was obtained:
2 2
d 2x dx d2y dy
m 2 + cS = 0 m 2 + cS = − mg (1)
dt dt dt dt
In case the resistance of environment is not considered (i.e. the coefficient of aerodynamic
resistance c = 0 ), we have the system of equations for the balance of forces at the direction of
d 2x d2y
x and y axes: m 2 = 0 and m 2 = − mg . By their solution and integration concerning
dt dt
the initial conditions y (t = 0) = 0 we obtain the quadratic equation:
g
− x2 2
+ [Link]α = 0 [3], from which results that trajectory of motion of the
2v0 cos 2 α
cannonball has the form of parabola. The solution of the quadratic equation is searched length
of cannonball firing range x = 101 936,79m .
If the air resistance is not neglected at the solution of the physical problem, it is necessary to
solve the system of differential equations of the second order (1). If the relations for the
4
weight, volume and frontal area of the cannonball m = ρV , V = πr 3 , S = πr 2 are used, we
3
3
introduce the constant k = c and denote x = hx a y = h y , the relations (1) will be
4 ρr
transposed into the form of:
2
d 2 hx dh dhx
2
+ k x = 0 hx (t = 0) = x0 vx = = v0 cos α
dt dt dt t =0
2
(2)
d 2 hy dh y dh y
2
+ k = − g h y (t = 0 ) = y 0 vy = = v0 sin α
dt dt dt t =0
The system of two differential equations of the second order without or with the right side of
equation was obtained. An analytic solution of the problem is complex and it does not lead to
such simple dependancies for the coordinates of the ball shot as it was in case the air
resistance was not considered. The problem will thus be solved numerically by using an
interactive program Matlab.
3. MATLAB utilization at solving physical problem
Matlab presents a highly efficient language for technical calculations. It connects calculations,
visualization and programming into simply operable environment [4]. It is an interactive
device, where the basic data type is the field without necessity to declare its measurements.
This feature together with the number of built-in functions enables relatively easy solution of
many technical problems. It is a standard tool at teaching at school, for example mathematics
and other technical subjects, but also an effective tool for research, development and analysis
of data.
One of the methods of solution in Matlab is the m-files formation, which were used at solving
the problem. We created an m-file, into which we transformed the system of differential
equations of the second order (2) concerning the initial conditions into the system of
equations of the first order in the form of matrices. Then we formed a script, in which the
parameters used at solving the problem were defined. Single solution consists of the
calculation of length and time of the cannonball firing range and portrayal of the trajectory.
M-file strela2.m for the portrayal of the distance of the cannonball firing range is created in
fig. 2.
Figure 2. M-file for depiction of the graph.
The graph of trajectory of the cannonball at given α angle depicted by created m-file is
presented in fig. 3.
Figure 3. Graph of trajectory.
Single solution of the problem presents launching the script (fig. 4).
Figure 4. M-file for the calculation of the length and time of firing range.
It results from the numerical solution of such formed mathematical model of the physical
problem that firing range of the cannonball in case the air resistance is considered is
x = 5 960,3m .
4. Conclusions
It emerges from the results of solving the physical problem that the results obtained at solving
the problem differ concerning the formed mathematical model. Mathematical model of the
problem, if the air resistance was considered, led to more complex relations and numerical
method of solving by Matlab was used. Introduction and utilization of information and
communication means make teaching more attractive, which is necessary for the subjects as
mathematics, physics, chemistry, because they occur among the least favourite subjects.
Acknowledgement. This paper was supported by the grant Vega n. 1/0345/08.
References
[1] V. Koubek. Riešenie fyzikálnych úloh. MFF UK Bratislava, 1987.
[2] V. Koubek, I. Pecen. Matematické modelovanie fyzikálnych javov. Fyzikálne listy č.3,
1996.
[3] E. Fechová. Matematické modelovanie ako súčasť riešenia fyzikálnej úlohy. In:
Didmatech 2007, Olomouc 2007, p. 290-293. ISBN 80-7220-296-0.
[4] F. Dušek. MATLAB a SIMULINK úvod do používání. Univerzita Pardubice, 2002.
ISBN 80-7194-273-1.