Next Article in Journal
Landscape Aesthetics of Check Dams Based on Scenic Beauty Estimation Method and Artificial Intelligence Technology
Previous Article in Journal
Menstruation-Related Physical Condition Management for Women Using an Underwear-Type Wearable Biosensor
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

Analysis of One-Degree-of-Freedom Spring-Mass-Damper System with Nonlinear Spring Using Runge–Kutta Method †

1
International College of Semiconductor Technology, National Yang Ming Chiao Tung University, Hsinchu 300093, Taiwan
2
Department of Vehicle Engineering, National Formosa University, Yunlin 632, Taiwan
*
Author to whom correspondence should be addressed.
Presented at the 2024 IEEE 6th Eurasia Conference on IoT, Communication and Engineering, Yunlin, Taiwan, 15–17 November 2024.
Eng. Proc. 2025, 92(1), 1; https://doi.org/10.3390/engproc2025092001
Published: 10 April 2025
(This article belongs to the Proceedings of 2024 IEEE 6th Eurasia Conference on IoT, Communication and Engineering)

Abstract

:
Most engineering problems are described using differential equations, yet only a few can be solved analytically. Nonlinear differential equations are generally difficult to solve. The goal of numerical analysis is to minimize the difference between the numerical solution and the exact solution as much as possible. The Runge–Kutta method, particularly the fourth-order Runge–Kutta method (RK4), is a highly accurate numerical analysis technique. We applied the RK4 method to the analysis of a spring-mass-damper system with a nonlinear spring. The results show that the numerical solution of the displacement time response function of the spring-mass-damper system is accurate and precise, with six significant figures.

1. Introduction

Ordinary differential equations are classified into initial value problems (IVP) and boundary value problems (BVP) based on the form of the given conditions. For example,
IVP:   y = x 2 + y 2 ,   y ( 0 ) = 1 , y ( 0 ) = 1
and
BVP:   y = x 2 + y 2 ,   y ( 0 ) = 1 , y ( 1 ) = 2
where y stands for d y / d x .
Among them, IVP and BVP differ in that the conditions for IVP (initial conditions) are set at the same location, while the conditions for BVP (boundary conditions) are set at two different locations. Many practical problems are described using differential equations, but only a few types can be solved analytically. The numerical methods for solving IVP and BVP in ordinary differential equations have significant differences and require entirely different approaches.
For clarity, let us first consider the simplest initial value problem.
y = f ( x , y ) ,   x 0 x x n         I.C.     y ( x 0 ) = y 0
Euler’s Method is one of the simplest approaches for solving ordinary differential equations and serves as an excellent example to illustrate the principles of numerical methods [1]. We first consider a first-order ordinary differential equation of the form (3) and divide the interval ( x 0 , x n ) into N equally spaced subintervals. Therefore,
h = ( x n x 0 ) / N
and
x r = x 0   + r   h ,   r = 0 ,   1 ,   2 ,   ,   N
where h is called the step size. Let u r = y ( x r ) , and u r + 1 = y ( x r + 1 ) . According to the mean value theorem for integration, we obtain
u r + 1 = u r     +     h     f ( x r , u r ) ,       r = 0 ,       1 ,       2 ,       ,       N 1
and
u 0 = y 0
This method is known as Euler’s Method. The significance of using Euler’s Method, as represented by (6), is that it enables calculating u r + 1 . We use the function value u r at the previous point and add the product of the slope f ( x r , u r ) at the previous point and the step size h . This method leads to a gradual accumulation of integration errors and less accurate computation. The Runge–Kutta method improves upon the shortcomings of Euler’s Method, enhancing the accuracy of the calculation [1,2,3].

2. Research Method

The fundamental idea of the Runge–Kutta method is to calculate u r + 1 using (3). Appropriate corrections must be made in advance when the approximate expression of f ( x r ,   u r ) in (3) is obtained. Specific points in the interval ( x r ,   x r + 1 ) must be considered, and their values K j ,   j = 1 , 2 , ,   p multiplied by their corresponding weightings must be calculated to evaluate f ( x r + 1 , u r + 1 ) . This is the Runge–Kutta method, and its general representation is written as
u r + 1 = u r   +   j = 1 p w j h   K j ,
where p is number of points in the interval ( x r , x r + 1 ) , and w j ,   j = 1 ,   2 ,   ,   p are the weightings which are undetermined parameters corresponding to K j ,   j = 1 , 2 , , p which are the p specific values of function f. K j ,   j = 1 , 2 , , p can be written as
K ( x , u ) = f ( x , u ) ,   x r < x < x r + 1 ,
and
K j = f ( x r + c j h ,   u r + S = 1 j 1 a j s   h   K S ) ,
where c j and a j s are also undetermined parameters. These parameters can be derived by expanding Taylor’s Series and comparing the coefficients. By selecting different parameter values for p ,   c j ,   and   a j s , we obtain various forms of the Runge–Kutta method’s calculation formulas. In particular, RK4 is the most widely used [1,2,3]. The equations are as follows.
K 1 =   h   f ( x r , u r ) ,
K 2 =   h   f ( x r + 0.5 h , u r + 0.5 K 1 ) ,
K 3 =   h   f ( x r + 0.5 h , u r + 0.5 K 2 ) ,
K 4 =   h   f ( x r + h , u r + K 3 ) ,
u r + 1 = u r   +   ( K 1 + 2 K 2 + 2 K 3 + K 4 ) / 6 +   O ( h 5 ) .
Since calculating each step in the iteration requires evaluating four values of f from (3), it is referred to as RK4. RK4 allows for a numerical accuracy that reaches the fourth order (i.e., the error begins from the fifth order). As for higher-order methods, such as for second-order ordinary differential equation
y = f ( t , y , y ) ,   t 0 t t N             I.C.     y ( t 0 ) = y 0 , .   y ( t 0 ) = u 0 ,
to solve using RK4, let y = u , and then (16) is rewritten as a system of first-order ordinary differential equations as follows.
y = u ,
and
u = f ( t , y , u ) ,   t 0 t t N             I.C.     y ( t 0 ) = y 0 , . y ( t 0 ) = u 0 .
Thus, the procedure for solving the system of first-order ordinary differential (17a) and (17b) using RK4 is as follows,
K 11 = h u r ,
K 12 = h   f ( t r , y r , u r ) ,
K 21 = h ( u r + 0.5 K 12 ) ,
K 22 = h   f ( t r + 0.5 h , y r + 0.5 K 11 , u r + 0.5 K 12 ) ,
K 31 = h ( u r + 0.5 K 22 ) ,
K 32 = h   f ( t r + 0.5 h , y r + 0.5 K 21 , u r + 0.5 K 22 ) ,
K 41 = h ( u r + K 32 ) ,
K 42 = h   f ( t r + h , y r + K 31 , u r + K 32 ) .
Then
y r + 1 = y r +   ( K 11 + 2 K 21 + 2 K 31 + K 41 ) / 6 ,
and
u r + 1 = u r +   ( K 12 + 2 K 22 + 2 K 32 + K 42 ) / 6 .
The authors implemented the RK4 computation procedure using a Fortran program for analysis.

3. Results and Discussion

A one-degree-of-freedom spring-mass-damper system [2,3,4] is considered to have a nonlinear spring, as shown in Figure 1. Based on Newton’s second law of motion, the equation of motion for this spring-mass-damper system is expressed as
m X ¨   + c X ˙   +   k X   +   k * X 3 =   0   ,
where
  k = 2.0   N / cm = 200.0   N / m ,
  k * = 0.2   N / c m 3 = 0.2 × 10 6   N / m 3 ,
  C = 0.15   N sec / cm = 15   .0 N sec / m ,
  m = 1.0   kg ,
  X ( 0 ) = 10.0   cm = 0.1   m ,
  • and
  X ˙ ( 0 ) = 0.0   cm / sec = 0   m / sec .
The differential Equation (19) does not have an analytical solution. To obtain a numerical solution X ( t ) using RK4, we can rewrite (19) in terms of (17a) and (17b) as follows.
  Y 1   =   Y 2   ,
and
Y 2 =   15.0   Y 1 200.0 Y 1 0.2 × 10 6 Y 1 3   .
where Y 1   and Y 2 represent the displacement X ( t )   and velocity X ˙ ( t )   of the mass m, respectively.
By taking an appropriate step size h and treating y and u in (17a) and (17b) as Y 1 and Y 2 in (20a) and (20b), respectively, and treating f ( t , y , u ) in (17b) as Y 2 =   15.0   Y 1 200.0 Y 1 0.2 × 10 6 Y 1 3   . . in (20b). Thus, the procedure for solving the coupled first-order ordinary differential (20a) and (20b) using RK4 is identical to that of (18a) to (18j).
To obtain the numerical solution for the displacement time response function X ( t ) of mass m in Figure 1, the interval from 0 to 1.0 s is divided into N equally spaced subintervals with a step size of h = 1 / N . The values of N are taken as 100, 200, 400, 800, 1600, and 3200, and monitoring points are chosen at times t = 0.1, 0.2,…,1.0 s. The results are listed in Table 1, and the numerical solution of the displacement X ( t ) at N = 3200 is illustrated in Figure 2.
Figure 2 shows that the system exhibits damping, with the displacement time response function of mass m gradually decreasing over time, which is reasonable. Although there is no analytical solution for the displacement time response function of mass m in this system, the comparison of data from the ten monitoring points for N equal to 400 and 800, respectively, reveals that the first five significant figures are identical, indicating a high level of accuracy in the calculations. Additionally, comparing the data from ten monitoring points for N equal to 800 and 1600 also shows that the first six significant figures are completely the same. This indicates that the RK4 calculation results do not suffer from significant truncation or propagation error despite the increase in the number of subdivisions.

4. Conclusions

When analyzing data using a Fortran program, it is essential to declare all data types, except for integers, as double precision. This allows for numerical accuracy of up to 15 or 16 significant digits in decimal form, which reduces truncation errors, especially when the step size h is very small. This is evident from the numerical values of the transient displacement time response function of the mass analyzed using RK4 in Table 1, which shows that as the number of subdivisions increases, the calculated values change only slightly. In particular, when the number of subdivisions is increased to 3200, the corresponding numerical solutions at 3200 and 1600 subdivisions are almost identical for the first six significant figures. Therefore, the computed values do not exhibit significant propagation errors despite a large number of subdivisions.
Additionally, a comparison of (18a) to (18j) with (11) to (15) indicates that the increase in the order of the differential equations merely results in the repeated listing of (11) to (15). This demonstrates that obtaining numerical solutions for higher-order ordinary differential equations or higher-order systems of ordinary differential equations using the Runge–Kutta method is straightforward and effective.

Author Contributions

Conceptualization, K.-B.L.; methodology, K.-B.L.; software, T.-L.T.; validation, K.-B.L. and T.-L.T.; formal analysis, T.-L.T.; investigation, K.-B.L. and T.-L.T.; resources, K.-B.L. All authors have read and agree to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Jhang, R.S. Visual Basic Numerical Analysis and Engineering Applications; Gau Lih Book Company: New Taipei City, Taiwan, 2002. (In Chinese) [Google Scholar]
  2. Inman, D.J. Meirovitch, Engineering Vibration; Prentice-Hall: Englewood Cliffs, NJ, USA, 2008. [Google Scholar]
  3. Rao, S.S. Mechanical Vibration, SI ed.; Prentice-Hall: Englewood Cliffs, NJ, USA; Pearson Education South Asia Pte Ltd.: Singapore, 2005. [Google Scholar]
  4. Meirovitch, L. Fundamentals of Vibration, 4th ed.; Thomson Delmar Learning: New York, NY, USA, 2007. [Google Scholar]
Figure 1. One-degree-of-freedom spring-mass-damper system with a nonlinear spring.
Figure 1. One-degree-of-freedom spring-mass-damper system with a nonlinear spring.
Engproc 92 00001 g001
Figure 2. Graph of numerical solution for the displacement time response function X ( t ) of mass m for N equal to 3200.
Figure 2. Graph of numerical solution for the displacement time response function X ( t ) of mass m for N equal to 3200.
Engproc 92 00001 g002
Table 1. Numerical solutions for displacement time response function X ( t ) of mass m for N equal to 100, 200, 400, 800, 1600, and 3200, respectively.
Table 1. Numerical solutions for displacement time response function X ( t ) of mass m for N equal to 100, 200, 400, 800, 1600, and 3200, respectively.
t (s) N
100200400
0.1−0.592492 × 10−1−0.592513 × 10−1−0.592504 × 10−1
0.20.154889 × 10−10.155359 × 10−10.155370 × 10−1
0.30.158728 × 10−10.158568 × 10−10.158561 × 10−1
0.4−0.153815 × 10−2−0.155205 × 10−2−0.155224 × 10−2
0.5−0.409758 × 10−2−0.409822 × 10−2−0.409811 × 10−2
0.6−0.102147 × 10−2−0.101856 × 10−2−0.101848 × 10−2
0.70.567454 × 10−30.568581 × 10−30.568582 × 10−3
0.80.422563 × 10−30.422300 × 10−30.422283 × 10−3
0.90.183610 × 10−40.180209 × 10−40.180150 × 10−4
1.0−0.879862 × 10−4−0.880438 × 10−4−0.880420 × 10−4
t (s) N
80016003200
0.1−0.592503 × 10−1−0.592503 × 10−1−0.592503 × 10−1
0.20.155369 × 10−10.155369 × 10−10.155369 × 10−1
0.30.158561 × 10−10.158561 × 10−10.158561 × 10−1
0.4−0.155223 × 10−2−0.155223 × 10−2−0.155223 × 10−2
0.5−0.409810 × 10−2−0.409810 × 10−2−0.409810 × 10−2
0.6−0.101848 × 10−2−0.101848 × 10−2−0.101848 × 10−2
0.70.568580 × 10−30.568579 × 10−30.568579 × 10−3
0.80.422282 × 10−30.422282 × 10−30.422282 × 10−3
0.90.180153 × 10−40.180153 × 10−40.180153 × 10−4
1.0−0.880417 × 10−4−0.880416 × 10−4−0.880416 × 10−4
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Lin, K.-B.; Tien, T.-L. Analysis of One-Degree-of-Freedom Spring-Mass-Damper System with Nonlinear Spring Using Runge–Kutta Method. Eng. Proc. 2025, 92, 1. https://doi.org/10.3390/engproc2025092001

AMA Style

Lin K-B, Tien T-L. Analysis of One-Degree-of-Freedom Spring-Mass-Damper System with Nonlinear Spring Using Runge–Kutta Method. Engineering Proceedings. 2025; 92(1):1. https://doi.org/10.3390/engproc2025092001

Chicago/Turabian Style

Lin, Kuan-Bo, and Tzu-Li Tien. 2025. "Analysis of One-Degree-of-Freedom Spring-Mass-Damper System with Nonlinear Spring Using Runge–Kutta Method" Engineering Proceedings 92, no. 1: 1. https://doi.org/10.3390/engproc2025092001

APA Style

Lin, K.-B., & Tien, T.-L. (2025). Analysis of One-Degree-of-Freedom Spring-Mass-Damper System with Nonlinear Spring Using Runge–Kutta Method. Engineering Proceedings, 92(1), 1. https://doi.org/10.3390/engproc2025092001

Article Metrics

Back to TopTop