0% found this document useful (0 votes)
14 views14 pages

Solution of Damped Spring Vibration Model of Motor Vehicles With MATLAB Application

This study evaluates the effectiveness of the Milne Method, Runge Kutta 4 method, and Runge Kutta Gill method in solving the damped spring vibration model of two-wheeled motor vehicles using MATLAB. The Milne Method is found to be efficient for larger time steps but less accurate than the Runge Kutta 4 method, which offers higher accuracy but requires smaller time steps. The research highlights the importance of mathematical modeling in understanding vehicle dynamics and improving comfort and safety in transportation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views14 pages

Solution of Damped Spring Vibration Model of Motor Vehicles With MATLAB Application

This study evaluates the effectiveness of the Milne Method, Runge Kutta 4 method, and Runge Kutta Gill method in solving the damped spring vibration model of two-wheeled motor vehicles using MATLAB. The Milne Method is found to be efficient for larger time steps but less accurate than the Runge Kutta 4 method, which offers higher accuracy but requires smaller time steps. The research highlights the importance of mathematical modeling in understanding vehicle dynamics and improving comfort and safety in transportation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology

ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256

Solution of Damped Spring Vibration Model


of Motor Vehicles with MATLAB Application
(Model of Motor Vehicle Damped Spring Vibration)

Gilang Nitiasya Fawzi1; Yani Ramdani2


1,2
Mathematics Study Program
The Faculty of Mathematics and Natural Sciences
Universitas Islam Bandung, Indonesia

Publication Date: 2025/04/17

Abstract: This study analyzes the application of the Runge Kutte 4 method, Runge Kute Gill, and Milne Method in two-
wheeled motor vehicles. The study results show that: (1) Performance of the Milne Method: The Milne method is effective
for solving damped oscillatory systems with small time steps and provides good results, although with a slight increase in
error compared to the Runge Kutte 4 method. (2) Advantages The Milne method shows more efficiency in the number of
function evaluations per step. It is suitable for applications requiring more significant time steps without requiring
accuracy as high as the Runge Kutte 4 method. (3) Disadvantages The Milne method has lower accuracy than the Runge
Kutte 4 method, especially for small time steps and requires an initial step using another method, adding to the complexity
of the Implementation.

Keywords: Analysis; Runge Kutta; Runge Kutta Gill; Milne Method; Two-Wheeled Motorized Vehicles.

How to Cite: Gilang Nitiasya Fawzi; Yani Ramdani. (2025). Solution of Damped Spring Vibration Model of Motor Vehicles
with MATLAB Application. International Journal of Innovative Science and Research Technology,
10(4), 314-327. https://doi.org/10.38124/ijisrt/25apr256.

I. INTRODUCTION there are resistance factors in the form of air friction and
internal factors that cause the vibrations to decrease over
Motorized vehicles are a means of transportation that time and eventually stop slowly; such vibrations of objects
is very much needed by the community. Comfort and safety are usually referred to as damped harmonic motion [1].
of travel are among the most essential criteria when This phenomenon can be formed in a mathematical model.
choosing a vehicle. High speed demands the vibration-
damping system the most. Thus, motorized vehicles require Mathematics is a deductive science. The concepts in
springs that function as shock absorbers on the road and mathematics are hierarchical, structured, logical, and
wheel vibrations so that they are not directly transmitted to systematic, ranging from the simplest to the most complex
the vehicle body. Springs are components that function to [2]. Mathematics has a vital role in formulating real-life
receive dynamic loads and have elastic properties. Springs problems into a model, such as the problem of vibrations in
are also referred to as flexible objects; they can return to springs. The vibration model in a damped spring is an
their original position even though they have received ordinary differential equation that can be solved using
external force. Vibrations that occur if a load is attached or analytical and numerical methods. An analytical method is
hung to a spring are one example of vibration. a method that can provide actual results (exact solutions)
and solve some mathematical issues. At the same time, the
Vibrations can occur if a system is disturbed from its numerical method is an approach to the exact solution of a
stable equilibrium position. Vibrations in springs are mathematical problem. There are two methods to find
divided into simple harmonic motion and damped harmonic solutions to differential equations numerically: the one-step
motion. Simple harmonic motion is the vibration of an and multistep methods. This paper discusses the solution of
object that occurs continuously, and there are no resistance motor vehicles' damped spring vibration model using the
or damping factors. Simple harmonic motion can also be Runge-Kutta Method, Runge-Kutta Gill Method, and Milne
interpreted as a system that vibrates with a restoring force Method. Runge-Kutta Gill Method is a family of fourth-
directly proportional to its deviation's negative. The order Runge-Kutta methods, which include one-step
restoring force is a force that works in the direction of methods where the next step solution depends on the
returning the mass to its equilibrium position. In reality, previous solution value. Milne Method has many steps that
vibrations in an object will not occur continuously because can be used to find the approximate value of ordinary

IJISRT25APR256 www.ijisrt.com 314


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
differential equations and have predictor and corrector . In this condition, the resultant of all forces
values. acts with arbitrary time. In this case, the acceleration is a
second-order ordinary differential equation that has the
II. LITERATURE REVIEW form and the consequent is given by equation (2)
A. Model Osilasi then,
Oscillation occurs when a system receives
disturbances from its equilibrium position with repetitive (3)
motion. Many oscillations are easily recognized, for
example, a small boat swinging up and down, a clock so that a linear differential equation with constant
pendulum swinging left and right, and a vibrating guitar coefficients governs the system's motion. The damping
string. A system that exhibits simple harmonic motion is an force has a direction opposite to the object's motion at that
object attached to a spring [6]. Figure 1 shows an ordinary time, and it is assumed that this force is proportional to the
spring that withstands compression and elongation and velocity of the object. So, the damping force is in
hangs vertically from a fixed point. The spring's lower end the form of . The damping constant has a positive
is tied to an object with mass m. The mass m is considered value. The resultant force acting on the object
so large that the mass of the spring can be ignored. If the is . So, according to Newton's
object is pulled down a certain distance and then released, second law, the form is obtained,
the object will move. The following will determine the
motion of the mechanical system, assuming the object (4)
moves vertically. To achieve this goal, consider the forces
acting on the object during its movement. These forces will and it is seen that a linear differential equation with
lead to a differential equation, and by solving this equation, constant coefficients determines a damped mechanical
the displacement will be obtained as a function of time. The system. The free oscillations of an object on a spring can be
downward direction is chosen as the positive direction, the seen in Figure 1. Now assume the presence of a variable
force acting downward is considered positive, and the force acting on the system. The differential equation
upward force is considered harmful [6]. relating to this situation is obtained from equation (4) by
adding the forces of ; this addition produces equation
The force acting on an object is the gravitational force (5)
(g), with m being the object's mass and g (980
cm/sec2) being the acceleration due to gravity. Next, (5)
consider the spring force which works on objects,
namely, with s being the vertical displacement of called input or driving force; the solution is
the object (note that the upper end of the spring is called output as the system's response to the driving force.
stationary), while the constant k is called the spring The resulting motion is called forced motion, which is
modulus. If the object is at rest, then the gravitational force different from free motion related to equation (5), namely
and the spring force are in balance, and the resultant force motion without external motion . Periodic input is a
is zero so that the following mathematical form is obtained, special case of interest, sinusoidal, with the form of
with So, the
(1) differential equation that appears now is equation (6)

With s0 is the change in the length of the spring when (6)


the object is at rest, namely the static equilibrium position.
The object's displacement is measured from the static The suspension system on vehicles, especially
equilibrium position , symbolized by , motorcycles, functions as a shock absorber when the car is
which represents time, with the downward direction as the moving. The suspension also maintains the motorcycle's
positive direction, as shown in Figure 1. According to balance, making it easy to control. Thus, the main task of
Hooke's law, this shift causes an additional force of -ky that the suspension is to make the rider feel comfortable with
works on objects. Thus, the resultant force acting on the reduced shocks caused by road contours, reduce vibrations
object's position is due to engine work, and stabilize the vehicle when turning.
The research of Makoto Yokoyama and Masato Yamagishi
(2) [8] explains how the active steering system scheme with
one motor and the handlebar suspension is composed of
Suppose the damping of a system is so tiny that it can springs and dampers, as in the following picture,
be neglected so that equation (2) is the resultant of all the
forces acting on the object. The differential equation is
obtained using Newton's second law with the force being

IJISRT25APR256 www.ijisrt.com 315


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256

Fig 1: Spring System on Motorbike


(Source: Yokoyama and Yamagishi, 2022)

You can use the Runge-Kutta method to find the efficient for computer calculations [9]. Several types of
solution to equation (6). The Runge-Kutta method is a Runge-Kutta methods depend on the value of n (order) used.
method that provides greater accuracy of results and does For example, for called the first-order Runge-Kutta
not require derivatives of a function. The general form of method, also called the Euler method, which is obtained
the Runge-Kutta method is equation (7) from equation (9)

(7)

With is an incremental function, which is For then the equation becomes,


the average slope on an interval and is used to extrapolate
from old values to new value s throughout the
interval h. The addition function can be written in general
form in equation (8), In the Runge-Kutta method, after the value of n is
determined, the values of a, p, and q are then sought by
(8) equating equation (8) with the terms of the Taylor series in
the form of a function :
If a differential equation is known to have the form of
then based on the Runge Kutta method
approximation with is a constant whit for
is,
With , and so on are the first, second and
(9) so on derivatives of the function f(x) at point x. The methods
often used are the second-order Runge-Kutta method (RK2),
(10) the third-order Runge-Kutta method (RK3) and the fourth-
order Runge-Kutta method (RK4). The second-order Runge-
Next can be obtained Kutta method has the following form,

(11)

With values and as in equations (9) and (10) and for


values a1, a2, p1, and q11 evaluated by equating equation (11)
with the second-order Taylor series of the function f(x) is:

Where the function represents the ordinary


differential equation to be approximated, t is the time
variable, x is the value of the approximate solution at that
The value is obtained and
time, and h is the time step or interval length. The values of
p and q are constants. The value of k indicates the sequential by selecting , , and
relationship. The value appears in the equation of . Next, substitute these values into equation
both, which also appears in the equation of and so on. (11) so that the second-order Runge-Kutta method formula
This sequential relationship makes the Runge-Kutta method is obtained as follows.

IJISRT25APR256 www.ijisrt.com 316


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256

With

This fourth-order Runge-Kutta method has a higher


level of solution accuracy than the previous-order Runge-
and Kutta method. It is also easy to program and stable, with
small errors in truncation and rounding [9].

The Runge-Kutta Gill (RKG) method belongs to the


The third-order Runge-Kutta method is derived in the family of methods of the RK4. RKG has four intermediate
same way as the second-order Runge-Kutta method for n = calculation constants combined with other constants r, s, t,
3. The result of this derivation is six equations with eight and you. The Runge-Kutta Gill method has the following
unknowns. Therefore, two unknowns must be determined form,
first to obtain the remaining six unknowns. The third-order
Runge-Kutta method has the following form, (13)

With

With

And

The fourth-order Runge-Kutta method is the most


accurate compared to the second-and third-order Runge-
Kutta methods. Therefore, the fourth-order Runge-Kutta , , , ,
method is often used to solve a differential equation. The
fourth-order Runge-Kutta method (RK4) is derived similarly and n is the number of steps or
to the second-order Runge-Kutta method (RK2) for the iterations. Milne's method is a multistep method, so called
value of n = 4. The fourth-order Runge-Kutta method has because it requires more than one value The main
the following form, goal of the multistep method is to use information from
several previous points to calculate the
(12) estimated value better. Milne's method uses a predictor
equation to estimate the value from , and
with while the corrector equation is used to calculate the value
better. The one-step numerical method is used to obtain
the value of , and on the predictor equation.
The Lagrange polynomial approximates the predictor
equation in the Milne method, and the points used are
as follows: From these four points, it can be
formed as follows,

IJISRT25APR256 www.ijisrt.com 317


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
Then , it is substituted into the equation. to develop in terms of function and computing
performance. MathWorks Inc. now produces the
programming language. It combines programming,
computing, and visualization processes in an easy-to-use
work environment. MATLAB also has other general
And integrated so that the predictor equation is advantages, such as data analysis and exploration,
obtained, namely equation (14). algorithm development, modelling and simulation, plot
visualization in 2D and 3D, and the development of
graphical interface applications. In higher education,
(14)
MATLAB is used as a learning tool for mathematical,
engineering, and science programming at introductory and
Then, for the corrector equation, the value is also advanced levels, while in the industrial world, MATLAB is
approximated by the Lagrange polynomial. However, the chosen as a tool for research, development, and analysis of
points used are and , then it can be formed into: industrial products. MATLAB can be operated on
Windows, Linux, and macOS operating systems. In
addition, MATLAB can also be connected to other external
programming languages or applications, such as C, Java,
.NET and Microsoft Excel. MATLAB also provides a
toolbox that can be used for specific applications, such as
signal processing, control systems, fuzzy logic, artificial
neural networks, optimization, digital image processing,
bioinformatics, simulation and various other technologies
[11].
Then, it is substituted into the equation.
III. RESULT AND DISCUSSION

A. Dynamic Balance of Motorcycle Spring Vibrations


The principle of Newton's law is used to conduct a
dynamic equilibrium analysis in a motorcycle vehicle; the
And integrated using boundaries so that the sum of the forces at equilibrium is equal to zero, with the
corrector equation [10] is obtained as follows, initial step of analyzing the forces and components in the
car and the load on the vehicle. In Figure 3.1, it can be seen
(15) that a motorcycle has a shockbreaker (strut), wheels and
tyres. The car can be achieved during operation by
B. MATLAB considering equations (3) and (4) obtained.
MATLAB is software for programming, analysis, and
technical and mathematical computation based on matrices. and
MATLAB stands for Matrix Laboratory because it can
solve matrix-form calculation problems. The first version With x is a transfer, speed is the acceleration, K
of MATLAB was released in 1970 by Cleve Moler. is the spring constant, C is the damping constant, and m is
Initially, MATLAB was designed to solve linear algebra the object's mass.
equation problems. Over time, this program has continued

Fig 2: Motorcycle Suspension System


(Source: Kreyszig, 1993)

IJISRT25APR256 www.ijisrt.com 318


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
Given the equation Assume one of the solutions of the ordinary
differential equation (16) is , The characteristic
equation is

with is the total mass, is the mass of the


vehicle, and is the mass of the rider, then,
With the discriminant of the equation
above , then the roots of equation
(16) are complex numbers, namely,

Displacement is the change in the position of an


object. Velocity refers to the movement of an object from Then, the general solution of equation (16) is
one point to another in a unit of time. Furthermore,
acceleration is the change in velocity in a unit of time. The
concept of differential is used to calculate the change that
occurs per unit of parameter, such as time. In this case, the
derivative of displacement is velocity, while the derivative Assumed initial values x(0) = 0.02 and x’(0) = 0,05,
of velocity is acceleration. In addition, the spring force is then the value can be determined c1 dan c2, namely,
related to the distance the spring is moved multiplied by the
spring capacity constant. When the shock absorber is
compressed, there is a displacement in the spring. Force is (17)
related to speed, such as displacement that was originally
intact becomes shrunk in a certain time. The magnitude of for t = 0, then obtained
the force is determined by the mass or pressure on the
spring multiplied by the acceleration. The importance of
force balance in vehicles is important to note. A system can
be in equilibrium if the total force is equal to zero, as in
equation (4). The ordinary differential equation of the
spring vibration model has the form,
and

for m = 67,6 kg, c = 532,8 Ns/m, and k = 9102,46 N/m For initial requirements of so that ,
be obtained, and the first derivative of (17) is

(16)

For , and 0,0118, then the From equation (18), the graph shown in Figure 3 is
specific solution has the form. obtained.

Table 1: Data of Jupiter Z Motorcycle Suspension


(18) No Parameters Symbol Value Unit
1 Suspension stiffness k1 4534,46 N/m
Table 1 presents data on the suspension specifications 2 Wheel stiffness k2 4568 N/m
[11]. Based on Figure 2, the spring oscillates and reaches 3 Suspension damping C 532,8 Ns/m
equilibrium at time t = 2, with maximum strain achieved at 4 Front body mass mv 63 Kg
an x value of 0.020407, which then decreases over time. 5 Wheel mass MW 4,6 Kg

IJISRT25APR256 www.ijisrt.com 319


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256

Fig 3: Vibration Graph of Special Solution

Table 2: First Point Simulation Results of Special Solution


Equation
Time (t) Position (x)
0 0.02
0.01 0.020348
0.02 0.020407
0.03 0.020198
0.04 0.019743
0.05 0.019067
0.06 0.018196 So, the form of the first-order differential equation
0.07 0.017155 system is,
0.08 0.015972
0.09 0.014671

B. Spring Vibration Solution with Runge-Kutta Gill


Method
Uncertain systems can be model using high-order
differential equations, which are often difficult to solve
The Runge-Kutta Gill method has the following form,
through analytical methods, so a code is needed to design
the numerical method [8]. The frequency evaluation
technique proposed [9] is a multi-step algorithm applied
exponentially to first-order ordinary differential equations (19)
[10]. Determining the stability of the trajectory of a
nonlinear dynamical system with respect to time is a With
challenge both analytically and numerically [11]. Given the
second-order differential equation as follows, ,

Transformation of the spring vibration model into a


first-order ordinary differential equation by example:

IJISRT25APR256 www.ijisrt.com 320


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
, ) For , with n is several steps or
iterations, then based on the Runge Kutta Gill calculations
that have been described, a MATLAB program will be
, created to obtain a solution from each iteration in the form
of a table so that further analysis can be carried out and a
So that graph can be produced that can provide a clearer picture.

The code below implements the Runge-Kutta-Gill


method to determine the dynamic equilibrium of a
motorcycle in equation (18). The program also compares
the numerical results with the exact solution and calculates
the error. The following are the steps to draw the graph: (1)
Error versus time: The error graph is calculated by
Enter the r, s, t and your values with comparing the numerical solution with the exact solution;
(2) Position versus time: Position x(t) plotted against time t;
; ; ; (3) Speed against time: Speed of v(t) plotted against time t.
The processing results are shown in Figure 4.

Fig 4: Error Graph against Exact Solution of Runge Kutta Gill Method

Fig 5: Graph of Position Versus Time of Runge Kutta Gill Method

IJISRT25APR256 www.ijisrt.com 321


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256

Fig 6: Graph of Speed Versus Time of Runge Kutta Gill Method

 Script MATLAB Metode Runge Kutta Gill v(i+1) = v(i) + (1/6) * (l1 + l4) + (1/3) * (s * l2 + u_
function [t, x, v] = rukg(g, t0, x0, v0, h, n) coefficient * l3);
% Initialize vectors t, x, dan v
t = zeros(n+1, 1); % Update t value
x = zeros(n+1, 1); t(i+1) = t(i) + h;
v = zeros(n+1, 1); end
x_exact = (exp(-
% Set initial condition 3.940828402*t)).*(0.02*cos(10.91428636*t) +
t(1) = t0; 0.0118*sin(10.91428636*t));
x(1) = x0;
v(1) = v0; % Calculating error
error = abs(x - x_exact)
% Calculate constants r, s, t, dan u
r = (sqrt(2) - 1) / 2; figure;
s = (2 - sqrt(2)) / 2; plot(t, error);
t_koefisien = -sqrt(2) / 2; xlabel('Time(t)');
u_koefisien = 1 + sqrt(2) / 2; ylabel('Error');
title('Error to exact solution');
% Runge-Kutta-Gill Iterations end
for i = 1:n
% Calculates k1 and l1  Command Window untuk menjalankan script
k1 = h * v(i); k = 9102.46;
l1 = h * g(t(i), x(i), v(i)); m = 67.6;
c = 532.8;
% Calculates k2 and l2 g = @(t, x, v) -k/m*x - c/m*v;
k2 = h * (v(i) + 0.5 * l1); t0 = 0;
l2 = h * g(t(i) + 0.5 * h, x(i) + 0.5 * k1, v(i) + 0.5 * l1); x0 = 0.02;
v0 = 0.05;
% Calculates k3 and l3 h = 0.05; % steps
k3 = h * (v(i) + 0.5 * l2); n = 100; % number of iteration
l3 = h * g(t(i) + 0.5 * h, x(i) + r * k1 + s * k2, v(i) + 0.5 [t, x, v] = rukg(g, t0, x0, v0, h, n);
* l2); % Displaying results
disp('Numeric result:')
% Calculates k4 and l4 disp('--------------------------------')
k4 = h * (v(i) + 0.5 * l3); disp(' t x v ')
l4 = h * g(t(i) + h, x(i) + t_coefficient * k2 + u_ disp('--------------------------------')
coefficient * k3, v(i) + 0.5 * l3); disp([t, x, v])
figure;
% Update x dan v values using the Runge-Kutta-Gill subplot(2, 1, 1);
formula plot(t, x);
x(i+1) = x(i) + (1/6) * (k1 + k4) + (1/3) * (s * k2 + u_ xlabel('Time(t)');
coefficient * k3); ylabel('Position(x)');

IJISRT25APR256 www.ijisrt.com 322


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
title('Position (x) Against Time (v)'); l3 = h * g(t(i) + 0.5 * h, x(i) + 0.5 * k2, v(i) + 0.5 * l2);
subplot(2, 1, 2);
plot(t, v); % Calculates k4 and l4
xlabel('Time(t)'); k4 = h * (v(i) + 0.5 * l3);
ylabel('Speed(v)'); l4 = h * g(t(i) + h, x(i) + k3, v(i) + 0.5 * l3);
title('Speed (v) Against Time (v)');
% Updates x dan v value
Based on Figure 4, Figure 5, and Figure 4, it can be x(i+1) = x(i) + (k1 + 2*k2 + 2*k3 + k4) / 6;
seen that the spring oscillates and reaches equilibrium at t = v(i+1) = v(i) + (l1 + 2*l2 + 2*l3 + l4) / 6;
1.65, stretches maximally at a value of 0.02 for position x
versus time and stretches maximally at a value of v = % Updates t value
0.0586 for velocity versus time and has the most significant t(i+1) = t(i) + h;
error of 0.9220. This code and graph simulate a damped end
oscillatory system with an accurate numerical approach. x_exact = (exp(-
The resulting graph is based on the expectations of the 3.940828402*t)).*(0.02*cos(10.91428636*t) +
physical model, where damping causes a decrease in the 0.0118*sin(10.91428636*t));
amplitude of oscillations in position and velocity. These
results will be compared with the 4th Order Runge Kutta % Calculates error
Method. This code uses the 4th-order Runge-Kutta method error = abs(x - x_exact)
to solve the system of differential equations in equation
(18). This method is a high-accuracy numerical approach, figure;
similar to the previous Runge-Kutta-Gill method, but plot(t, error);
without specific additional constants. The program xlabel('t');
produces graphs including (1) Error to the exact solution, ylabel('Error');
namely the error graph between the numerical solution and title('Error with exact solution');
the exact solution; (2) Position x(t) versus time, namely the end
position of the object versus time using the numerical
solution; and (3) Velocity v(t) against time, namely the Command Window to run the script
velocity of the object against time using a numerical k = 9102.46;
solution. Figure 6 is the resulting graph. Figure 5 and m = 67.6;
Figure 6 are the MATLAB scripts for the 4th Order Runge c = 532.8;
Kutta Method and the Command Window to run the script. g = @(t, x, v) -k/m*x - c/m*v;
t0 = 0;
 Script MATLAB Metode Runge Kutta Orde 4 x0 = 0.02;
function [t, x, v] = rk4(g, t0, x0, v0, h, n) v0 = 0.05;
% Initializes vectors t, x, dan v h = 0.05; % steps
t = zeros(n+1, 1); n = 100; % iterations number
x = zeros(n+1, 1); [t, x, v] = rk4(g, t0, x0, v0, h, n);
v = zeros(n+1, 1); % Displaying the result
disp('Numerik result:')
% Sets the initial condition disp('--------------------------------')
t(1) = t0; disp(' t x v ')
x(1) = x0; disp('--------------------------------')
v(1) = v0; disp([t, x, v])
figure;
for i = 1:n subplot(2, 1, 1);
% Calculates k1 and l1 plot(t, x);
k1 = h * v(i); xlabel('Time(t)');
l1 = h * g(t(i), x(i), v(i)); ylabel('Position(x)');
title('Position (x) Against Time (v)');
% Calculates k2 and l2 subplot(2, 1, 2);
k2 = h * (v(i) + 0.5 * l1); plot(t, v);
l2 = h * g(t(i) + 0.5 * h, x(i) + 0.5 * k1, v(i) + 0.5 * l1); xlabel('Time(t)');
ylabel('Speed(v)');
% Calculates k3 and l3 title('speed (v) Against Time (v)');
k3 = h * (v(i) + 0.5 * l2);

IJISRT25APR256 www.ijisrt.com 323


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256

Fig 7: Graph of Error to Exact Solution of RK4

Fig 8: Graph of Position againt Time of RK4

Fig 9: Graph of Speed againt Time of RK4

Based on Figure 7, Figure 8, and Figure 9, it can be allows long-term system analysis without significant error
seen that the spring oscillates and reaches equilibrium at accumulation. In general, RK4 successfully solves the
time t = 1.65. It stretches maximally at x = 0.02 for position differential equations of the damped oscillatory system with
x versus time and at 0.0557 for velocity v versus time and consistent and accurate results. The position and velocity
has the most significant error of 0.7011. Compared to the graphs show how the system energy is dissipated due to
Runge-Kutta-Gill method, RK4 is more accurate for this damping. The error in the exact solution is small, which
system because it has more local minor mistakes than RK- shows the reliability of the RK4 numerical method for this
Gill. RK4 is more stable for time steps h = 0.05, which physical system.

IJISRT25APR256 www.ijisrt.com 324


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
C. Solusi Model Getaran Pegas dengan Metode Milne % Calculates k1 and l1
The Milne method is a predictor-corrector method that k1 = h * v(i);
combines several previous steps to calculate the following l1 = h * g(t(i), x(i), v(i));
values. This method is usually used in ordinary differential
equations because of its efficiency and accuracy in smooth % Calculates k2 and l2
solutions. The Milne method is a continuation of the Runge k2 = h * (v(i) + 0.5 * l1);
Kutta Gill method, namely as a prediction stage for l2 = h * g(t(i) + 0.5 * h, x(i) + 0.5 * k1, v(i) + 0.5 *l1);
equation (16) as in equation (14)
% Calculates k3 and l3
k3 = h * (v(i) + 0.5 * l2);
l3 = h * g(t(i) + 0.5 * h, x(i) + 0.5 * k2, v(i) + 0.5 *l2);

% Calculates k4 and l4
k4 = h * (v(i) + 0.5 * l3);
l4 = h * g(t(i) + h, x(i) + k3, v(i) + 0.5 * l3);
The next stage is to correct equation (16) as in
equation (15). So that we obtain % Updates x dan v values
x(i+1) = x(i) + (k1 + 2*k2 + 2*k3 + k4) / 6;
v(i+1) = v(i) + (l1 + 2*l2 + 2*l3 + l4) / 6;

% Updates t value
t(i+1) = t(i) + h;
end
for i = 4:n
Based on the provisions of the Milne method that have % Calculates approximate values using the Milne
been described, a Matlab program will be created from the method
Milne method, which aims to obtain the results of each x_pred = x(i-3) + 4*h/3 * (2*v(i-2) - v(i-1) + 2*v(i));
iteration in the form of a table so that further analysis can v_pred = v(i-3) + 4*h/3 * (2*g(t(i-2), x(i-2), v(i-2)) -
be carried out and produce a graph that can provide a (g(t(i-1), x(i-1), v(i-1))) + (2*g(t(i), x(i), v(i))));
clearer picture. This program will create a graph in the form
of (1) Error against the exact solution, (2) Position x(t) % Calculates the correction value using the Milne
against time, and (3) Velocity v(t) against time. method
x_corr = x(i-1) + h/3 * (v(i-1) + 4*v(i) + v_pred);
The simulation results on the unique equation (18) v_corr = v(i-1) + h/3 * (g(t(i-1), x(i-1), v(i-1)) +
obtained three result graphs from the Milne method 4*g(t(i), x(i), v(i)) + g(t(i+1), x_pred, v_pred));
simulation: (1) Error Graph against Time: This shows the
absolute difference between the numerical solution and the % Updates x and v values
exact solution. This graph provides an overview of how x(i+1) = x_corr;
accurate the Milne method is in solving ordinary v(i+1) = v_corr;
differential equations: (2) Position Graph against Time:
Shows the change in system position (x) over time. The % Updates t value
position oscillates with damping, as expected for a damped t(i+1) = t(i) + h;
spring system; and (3) Velocity Graph against Time: This end
shows the change in system velocity (v) over time, which x_exact = (exp(-
also oscillates with reduced amplitude due to damping. The 3.940828402*t)).*(0.02*cos(10.91428636*t) +
graphs are presented in Figure 10, Figure 11, and Figure 12. 0.0118*sin(10.91428636*t));
The MATLAB script for the Milne method is as follows.
% Calculating error
 Script MATLAB Metode Milne error = abs(x - x_exact)
function [t, x, v] = milneMethod(g, t0, x0, v0, h, n)
% Initializes vectors t, x, dan v figure;
t = zeros(n+1, 1); plot(t, error);
x = zeros(n+1, 1); xlabel('Time(t)');
v = zeros(n+1, 1); ylabel('Error');
title('Error Towards Exact Solution');
% Set the initial condition end
t(1) = t0;
x(1) = x0; Here is the Command Window to run the script
v(1) = v0;
k = 9102.46;
for i = 1:3 m = 67.6;

IJISRT25APR256 www.ijisrt.com 325


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
c = 532.8; disp([t, x, v])
g = @(t, x, v) -k/m*x - c/m*v; figure;
t0 = 0; subplot(2, 1, 1);
x0 = 0.02; plot(t, x);
v0 = 0.05; xlabel('Time(t)');
h = 0.005; % steps ylabel('Position(x)');
n = 400; % number of iteration title('Position (x) Against Time (t)');
[t, x, v] = milneMethod(g, t0, x0, v0, h, n); subplot(2, 1, 2);
% Displaying results plot(t, v);
disp('Numeric result:') xlabel('Time(t)');
disp('--------------------------------') ylabel('Speed(v)');
disp(' t x v ') title('speed (v) Against Time (t)');
disp('--------------------------------')

Fig 10: Graph of Error against Exact Solutions of Milne Method

Fig 11: Graph of Position Against Time of Milne Method

Fig 12: Graph of Velocity Versus Time Milne Method

IJISRT25APR256 www.ijisrt.com 326


Volume 10, Issue 4, April – 2025 International Journal of Innovative Science and Research Technology
ISSN No:-2456-2165 https://doi.org/10.38124/ijisrt/25apr256
Based on Figure 10, Figure 11, and Figure 12, it can improvement are: (1) Reducing the time step (h) Reducing
be seen that the spring oscillates and reaches an equilibrium hh can improve the accuracy of the Milne method, but with
point at around t = 2 and stretches maximally by x = 0.0204 an increase in the number of iterations and computational
for position x versus time and stretches maximally at a time. (2) Use of Hybrid Methods: Combining Milne with
value of 0.0500 for velocity versus time with the most other predictor-corrector methods or dynamic time step
significant error of 0.1095. Based on the results above, the adaptation to improve stability and accuracy. (3) To ensure
data processing results that can be analyzed are (1) consistency and accuracy, further validation is needed to
Accuracy. The Milne method requires initial values compare the Milne results with other numerical methods,
calculated from other methods, such as the RK4. This is a such as the Adams-Bashforth method.
general and practical approach, but it depends on the step h.
If h is too large, the initial results may not be accurate REFERENCES
enough, causing error accumulation in subsequent
iterations; (2) Stability. The Milne method is an explicit [1]. D. Giancoli, R. Resnick dan J. Walker, Fisika Dasar,
method that has a stability limit. For systems with damped Jakarta: Erlangga, 2005.
oscillations, numerical stability depends on the step h. If h [2]. J. Clerk Maxwell, A Treatise on Electricity and
is too large, this method can become unstable; (3) Magnetism, 3rd ed., vol. 2. Oxford: Clarendon,
Efficiency. The prediction and correction processes are 1892, pp.68-73.
calculated for each iteration. You can improve efficiency [3]. I.S. Jacobs and C.P. Bean, “Fine particles, thin films
by checking the convergence of predictions and corrections and exchange anisotropy,” in Magnetism, vol. III,
(e.g., stopping the correction iteration if the relative G.T. Rado and H. Suhl, Eds. New York: Academic,
changes are small enough); (4) Error Calculation. The error 1963, pp. 271-350.
graph is quite informative, but it presents the relative errors [4]. K. Elissa, “Title of paper if known,” unpublished.
. [5]. R. Nicole, “Title of paper with only first word
capitalized,” J. Name Stand. Abbrev., in press.
[6]. Y. Yorozu, M. Hirano, K. Oka, and Y. Tagawa,
It may be more relevant to evaluate the solution in “Electron spectroscopy studies on magneto-optical
cases where the scale of the xx positions changes media and plastic substrate interface,” IEEE Trans.
significantly; (5) Modularity. The code can be more J. Magn. Japan, vol. 2, pp. 740-741, August 1987
modular by separating key functions, such as Runge-Kutta [Digests 9th Annual Conf. Magnetics Japan, p. 301,
and Milne calculations, into separate functions to improve 1982].
readability and maintainability. [7]. M. Young, The Technical Writer’s Handbook. Mill
Valley, CA: University Science, 1989.
IV. CONCLUSION [8]. Kuang, J., Wang, M., Han, J., & Sheng, Y. (2023).
Improved Milne-Hamming Method for Resolving
Based on the three methods above, it can be High-Order Uncertain Differential
concluded that (1) Accuracy and stability. The Runge-Kutta Equations. Applied Mathematics and
of Order 4 (RK4): (a) It shows higher accuracy and minor Computation, 457, 128199.
errors and is more stable than Milne. (b) It suits complex [9]. Ixaru, L. G., & Rizea, M. (1980). A Numerov-like
dynamics or rapid change systems more suitably. Runge- scheme for the numerical solution of the
Kutta-Gill: (a) Slightly more accurate than Milne but less Schrödinger equation in the deep continuum
accurate than RK4, and (b) Milne can be an efficient choice spectrum of energies. Computer Physics
for significant time steps with moderate accuracy Communications, 19(1), 23-27.
requirements. (2) Computational Efficiency. Milne's [10]. Van de Vyver, H. (2005). Frequency evaluation for
method is more efficient regarding the number of function exponentially fitted Runge–Kutta methods. Journal
evaluations per step than RK4. However, it requires smaller of computational and applied mathematics, 184(2),
time steps to achieve equivalent accuracy, which can offset 442-463.
this efficiency. RK4 requires four function evaluations per [11]. Steyer, A. J., & Van Vleck, E. S. (2016). A step-size
step, making it more computationally intensive. However, selection strategy for explicit Runge–Kutta methods
its higher accuracy can reduce the need for small time based on Lyapunov exponent theory. Journal of
steps. (3) Implementation. Milne's method requires an computational and applied mathematics, 292, 703-
initial step using another method (e.g., RK4) to start the 719.
Milne iteration, and Implementation can be more complex
due to the nature of the predictor-corrector. The RK4
method shows a more direct implementation and does not
require additional initial steps, making it generally more
straightforward to use. Milne can be a good choice for
simple damped oscillatory systems requiring computational
efficiency. For applications that require high accuracy and
better stability, especially in long-term simulations, the
RK4 method is more recommended. Suggestions for

IJISRT25APR256 www.ijisrt.com 327

You might also like