Optimization algorithm for accelerated solution of multi-degree-of-freedom human body spring-concentrated mass model

Through the optimization algorithm, the fourth-order Longge-Kuta method and linear interpolation technology are used to solve the problem of long calculation time of multi-degree-freedom human spring-central mass model, and the rapid solution and efficient calculation are achieved, and research efficiency is improved.

CN118981850APending Publication Date: 2024-11-19BEIJING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411063198.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

Under the impact load of the human body, it is difficult for the prior art to quickly solve the multi-degree-of-freedom human spring-centralized mass model, resulting in too long calculation time and affecting the research efficiency.

Method used

The fourth-order Longge-Kuta method is used to optimize the algorithm, and the input curve is loaded at one time and saved, and the speed curve is obtained in advance. Anonymous functions and linear interpolation are used to pre-organize the constant term coefficients, simplify the Jacobian matrix operation, and reduce repeated calculations.

Benefits of technology

It significantly improves the calculation efficiency, reduces the calculation time of the motion equation of the multi-degree of freedom human spring-centralized mass system, reduces the calculation cost, and improves the research efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118981850A_ABST
    Figure CN118981850A_ABST
Patent Text Reader

Abstract

The invention provides an optimization algorithm for accelerated solution of a multi-degree-of-freedom human body spring-concentrated mass model, aiming at the condition that the number of sampling points of an input curve is large, the input curve can be loaded at one time and stored, and then the curve is substituted into a calculation function for multiple times through syntax of an anonymous function. The method comprises the following steps: writing a mapping relation between an interpolation point t and an interpolation subscript i aiming at a linear and equal-time-interval interpolation problem, and carrying out linear interpolation through dZ0 = w1 * dZ0 (i1) + w2 * dZ0 (i2) to obtain dZ0 (t); z0 (t) is obtained through linear interpolation of Z0 = w1 * Z0 (i1) + w2 * Z0 (i2); the interpolation method can greatly reduce the operation time. For constant term coefficients in a second-order differential equation, the second-order differential equation is reduced into a first-order differential equation, a simpler form is obtained through simplification, and then partial derivatives of all parts are solved through a Jacobian matrix, so that numerical values of the constant term coefficients can be obtained. According to the method, the calculation time of the motion equation of the multi-degree-of-freedom human body spring-concentrated mass system is greatly shortened, and the calculation efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of solving typical organ responses of a human body equivalent theoretical model under vibration impact, and in particular relates to an optimization algorithm for accelerating the solution of a multi-degree-of-freedom human body spring-lumped mass model. Background Art

[0002] Ships are important components of the sea. Under complex sea conditions, the hull structure will produce violent impact motion, especially the impact in the vertical direction will cause different degrees of damage to the structure, equipment and personnel. Therefore, studying the dynamic response law of the crew under the impact load has important guiding significance for improving the combat vitality of ships. For the study of human body injuries, commonly used research methods include experiments, equivalent dummy models, finite elements, theoretical models (lumped mass parameter models), etc. Compared with other protection engineering design methods, the lumped parameter model can greatly shorten the research cycle and reduce costs while ensuring accuracy. Therefore, the lumped mass parameter model is widely used in the field of human body impact response research.

[0003] In order to collect the real time domain response data of the structure during experimental measurement, the sampling rate of the equipment is usually set to more than 200k. Therefore, the experimental data obtained, such as acceleration and pressure, are often curves composed of a large number of discrete data points. When using these experimental data to construct a human body equivalent theoretical model, due to the large number of loaded data, it often consumes a lot of computing time, so it is necessary to propose corresponding optimization methods to reduce the amount of calculation.

[0004] Different problems have different optimization methods to speed up calculations. For example, large-scale complex optimization problems are widely used in related scientific and technological fields such as machine learning, aircraft design, and DNA sequence compression. However, related optimization problems involve a large number of design variables, which consumes a lot of computing time, so speeding up the calculation is particularly important. In order to cope with the optimization search difficulties caused by a large number of design variables, a series of innovative algorithms have emerged in recent years. Local search algorithms, model reduction algorithms, and variable grouping algorithms are all among these algorithms. Among them, variable grouping algorithms have been widely studied and developed in recent years due to their ability to effectively reduce the scale of problems and ensure the accuracy of optimization problems. The variable grouping algorithm divides a large-scale optimization problem into multiple sub-problems and performs iterative optimization. By converting high-dimensional exponential problems into linear superpositions of multiple low-dimensional problems, the optimization efficiency is greatly improved. In order to solve the problem of large computational time brought by complex computational models, many related algorithms have also emerged in recent years, such as model simplification algorithms and proxy model algorithms. Model simplification algorithms often rely on classical theories and engineering experience, and are difficult to implement. The proxy model algorithm can use a sample set collected based on experimental design to establish a fast evaluation model to replace the time-consuming computational model, thereby improving computational efficiency. Surrogate model algorithms have become one of the most commonly used measures to improve computational efficiency.

[0005] In order to maximize computational efficiency, variable grouping and surrogate model algorithms are usually used simultaneously. The combination of grouping algorithms and surrogate models improves computational efficiency to a certain extent. Summary of the invention

[0006] The present invention aims at accelerating the computing speed and provides an optimization algorithm for accelerating the solution of a multi-degree-of-freedom human spring-lumped mass model. The main means involved are the following four:

[0007] Method 1: When there are many sampling points in the input curve, it will take more time to extract the curve. When the fourth-order Runge-Kutta method is used to solve the motion equations of a multi-degree-of-freedom human spring-concentrated mass system, the input curve will be reloaded in each iteration. Therefore, in order to speed up the calculation, the input curve can be loaded and saved at one time, and then the curve can be substituted into the calculation function multiple times through the anonymous function syntax.

[0008] Means 2: Further calculation of the input curve of the load, for example, when the input curve of the load is an acceleration curve, its corresponding velocity curve will also be used in the calculation function. The fourth-order Runge-Kutta method integrates the acceleration curve in each iteration to obtain the velocity curve, and then brings it into the calculation function, which will take a lot of time. The optimization algorithm proposed in this patent for accelerating the solution of the motion equation of the multi-degree-of-freedom human spring-concentrated mass system will integrate its acceleration curve in advance to obtain the velocity curve, and the subsequent calculation will directly substitute the velocity curve into the function for calculation.

[0009] Means 3: Commonly used one-dimensional interpolation (interp1) is applicable to any form of non-uniform f(x) sampling, such as linear, spline and other interpolation methods. Although this interpolation method has a wide range of applications, it takes a lot of time to check whether the input curve is correct each time it interpolates, resulting in slow search for interpolation points. When the input curve is sampled at equal time intervals, linear interpolation can be used. This linear interpolation estimates the value based on the two data points adjacent to the point to be interpolated in the one-dimensional data sequence. This estimation method allocates their weights according to the distance from the point to be interpolated to the two data points, that is, the interpolation weight w 1 and w 2 . Then the conceptually complex interpolation can be reduced to addition, subtraction, multiplication, division, and rounding, and the operation speed is very fast. Due to the requirement for parameter protection, it is necessary to judge some states of the input parameters or the processing process to determine whether the program can / needs to continue to execute. In MATLAB software, assertion functions (assert) are often used to assert its correctness. Therefore, it is possible to assert that the time columns in the data are equally spaced and the sampling error is small (such as no more than 1e -10 ) to ensure the correctness of the interpolation. Method 4: Fourth-order Runge-Kutta method (ode45) When solving the motion equations of a multi-degree-of-freedom spring-concentrated mass system, each function operation, a large number of lines of code are used to calculate the constant term coefficients, which are constant, but each iterative calculation will take a lot of time to recalculate these constant term coefficients. For the motion equations of a multi-degree-of-freedom spring-concentrated mass system:

[0010] M·ddX+C·dX+K·X=f K ·Z 0 +f C ·dZ 0

[0011] This equation is a second-order differential equation. Reducing the differential equation to a first-order differential equation will yield dX = A*(X, dZ 0 , Z 0 ) is in the form of a linear differential equation dX = A·X + b1·dZ, which is independent of time t. 0 +b 2·Z 0 Extract the algebraic expressions for X, Z0, and dZ0 from odefun, and then solve for dX = A·X + b1·dZ 0 +b 2 ·Z 0 Find the Jacobian matrix, that is, find the pair dX = A·X + b1·dZ 0 +b 2 ·Z 0 The partial derivatives with respect to each independent variable X are A, and dX = A·X + b1·dZ is found 0 +b 2 ·Z 0 About dZ 0 The partial derivative of b 1 , and finally dX=A·X+b1·dZ 0 +b 2 ·Z 0 Ask about Z 0 The partial derivative of b 2 This completely pre-arranges the constant coefficients A and b 1 and b 2 In subsequent iterative calculations, it will not take a lot of time to recalculate these constant term coefficients, and the time for calculating the constant term coefficients is 0. Since the loaded acceleration curve is integrated in advance, the displacement curve Z is obtained. 0 and speed curve dZ 0 Therefore, when these two curves are substituted into the calculation, the time consumed by linear interpolation is approximately equal to the time to retrieve an array element once. The calculation of the entire fourth-order Runge-Kutta method (ode45) is simplified, so the calculation speed is greatly improved.

[0012] The specific technical solution is:

[0013] The optimization algorithm for accelerating the solution of the multi-degree-of-freedom human spring-concentrated mass model is divided into five parts, each of which has three degrees of freedom in the horizontal direction X, vertical direction Z and rotation θ, and the entire model has 15 degrees of freedom. The proposed 15-degree-of-freedom human concentrated mass parameter model has 15 coupled non-homogeneous differential equations, which are expressed in matrix form as follows:

[0014] M·ddX+C·dX+K·X=f K ·Z 0 +f C ·dZ 0

[0015] Where M, K and C are 15*15 mass matrix, spring stiffness matrix and damping coefficient matrix respectively; ddX, dX and X are 15*1 acceleration, velocity and displacement vectors respectively; f k and f cis the 15*1 coefficient vector used to support the motion; dZ 0 and Z 0 is the velocity and displacement caused by external excitation; X represents the displacement X 1 , X 2 , X 3 ...X 15 ; dX represents the speed dX 1 、dX 2 、dX 3 …dX 15 ;ddX represents acceleration ddX 1 ,ddX 2 ,ddX 3 ……ddX 15 ; Reduce the differential equation to a first-order differential equation and obtain dX = A*(X, dZ 0 , Z 0 ) in the form of dX = A·X + b1·dZ 0 +b 2 ·Z 0 ;

[0016] The specific steps include:

[0017] Step 1: global ticks declares global variables to display the current calculation position. Let ticks = 0 to start from step 0;

[0018] Step 2: Load the acceleration curve and set up a MATLAB-based linear interpolation function to confirm the subsequent dZ 0 , Z 0 Is the acceleration result correct? And do trapezoidal integration on the acceleration curve in advance to get the speed curve dZ 0 , and then dZ 0 Do trapezoidal integration to get the displacement curve Z 0 ;

[0019] Step 3: Create a symbol vector about X. Since the system state is X 1 , X 2 , X 3 ...X 30 , so the code is x=sym('X',[30,1]);

[0020] Step 4: Substitute the independent variables X and dZ 0 and Z 0 , find the symbolic expression of dX with respect to the independent variable, that is, dX = odefun([], X, sym('dZ 0 '), sym('Z 0 '));

[0021] Step 5: Create a 30*30 Jacobian matrix A=sym(zeros(30)); then use a for loop to traverse each independent variable and find the partial derivative of dX with respect to each independent variable X to obtain A, that is, A(:, i)=diff(dX, X(i)); find the derivative of dX with respect to dZ 0 The partial derivative of b 1 That is b 1 =diff(dX,sym('dZ 0 ')); Find dX with respect to Z 0 The partial derivative of b 2 That is b 2 =diff(dX,sym('Z 0 '));

[0022] Step 6: Use assert(all(double(A*X+b 1 .*sym('dZ 0 ')+b 2 .*sym('Z 0 ')-dX)==0)) assert dX=A·X+b1·dZ 0 +b 2 ·Z 0 ;

[0023] Step 7: Convert A into a numerical matrix by A=double(A); use b 1 =double(b 1 ) 1 Convert to a numerical matrix; use b 2 =double(b 2 ) 2 Convert to a numeric matrix;

[0024] Step 8: Initialize the DY array, then iterate through each moment through a for loop, and then use DY(i,:)=odefun2(T(i),Y(i,:)',t 0 , dt, dZ 0 _, Z 0 _, A, b 1 , b 2 ) derive the DY value in odefun2; then use ref = odefun(T(i), Y(i,:)', dZ 0( T(i)), Z 0 (T(i)))', get the reference value of the original odefun;

[0025] Then assert(max(abs(DY(i,:)-ref)) / (max(max(abs(DY(i,:)), abs(ref)))+eps())<1e -10 ) to assert that the value output by odefun2 is within 1e of the value output by odefun -10 ;

[0026] Step 9: Write an accelerated version of odefun, namely function dx = odefun2(t, X, t 0 , dt, dZ 0 _, Z 0 _, A, b 1 , b 2 );The calculation formula of odefun is dX=A·X+b1·dZ 0 +b 2 ·Z 0 ; Input: time t, state vector X, initial time t 0 , sampling interval dt, sampling vector dZ 0 , sampling vector Z 0 , coefficient matrix A, coefficient vector b 1 , coefficient vector b 2 . Output: state derivative dX / dt;

[0027] Step 10: Use the global variable global ticks to record the number of times odefun is run; ticks = ticks + 1 means the number of runs increases by one; use iffloor(ticks / 100000) == ticks / 100000 to indicate every 100000 calls. Then use disp(t) to output the current t value;

[0028] Step 11: Use index=(tt 0 ) / dt+1Find the number of rows in the sampling table at the current time t, round down to get the sampling at the earlier time, that is, i 1 =floor(index); round up to get the sample at a later time, that is, i 2 = ceil(index); the weight of the earlier sampling is 1-(the distance between the sampling point and time t), that is, w 1 =1-(index-i 1 ); The weight of the later sampling is 1-(the distance between the sampling point and time t), that is, w 2 =1-(-i 2 -index);

[0029] If the row number index corresponding to the current moment is exactly 1, then w 1=w 2 , at this time ww=2; let w 1 =w 1 / ww;w 2 =w 2 / ww. Normalize the weight to w 1 +w 2 =1; at this time, through dZ 0 =w 1 ·dZ 0 (i 1 )+w 2 ·dZ 0 (i 2 ) Linear interpolation to get dZ 0 (t); by Z 0 =w 1 ·Z 0 (i 1 )+w 2 ·Z 0 (i 2 ) Linear interpolation to get Z 0 (t); finally use the calculation formula dX = A·X + b1·dZ 0 +b 2 ·Z 0 Perform calculations.

[0030] Step 12: Write function dX = odefun(~, X, dZ 0 , Z 0 ) is the unaccelerated odefun, which is a fourth-order Runge–Kutta method.

[0031] Beneficial effects of the present invention: For the case where the input curve has many sampling points, the present invention can load the input curve once and save it, and then substitute the curve into the calculation function multiple times through the syntax of anonymous function. For the linear and equal time interval interpolation problem, the mapping relationship between the interpolation point t and the interpolation subscript i can be written, and the mapping relationship between the interpolation point t and the interpolation subscript i can be written through dZ 0 =w 1 ·dZ 0 (i 1 )+w 2 ·dZ 0 (i 2 ) Linear interpolation to get dZ 0 (t); by Z 0 =w 1 ·Z 0 (i 1 )+w 2 ·Z 0 (i 2 ) Linear interpolation to get Z0 (t); the interpolation weight w here 1 and w 2 The size of is determined by the distance from the desired point to two adjacent data points. The interpolation method can greatly reduce the operation time. For the constant term coefficients in the second-order differential equation, it is only necessary to reduce the second-order differential equation to a first-order differential equation, simplify it to a simpler form, and then obtain the values ​​of these constant term coefficients by taking partial derivatives of each part through the Jacobian matrix. Therefore, the present invention greatly reduces the calculation time of the motion equations of the multi-degree-of-freedom human body spring-concentrated mass system, and effectively improves the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is the human body spring-lumped mass parameter model of the present invention;

[0033] Figure 2 It is a schematic diagram of the solution process of the Runge-Kutta method and the fast algorithm of the present invention;

[0034] Figure 3 is a schematic diagram comparing the computational efficiency of different algorithms of the present invention;

[0035] Figure 4 It is a schematic diagram comparing the calculation accuracy of different algorithms of the present invention. DETAILED DESCRIPTION

[0036] In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved more clearly, the present invention is further described in detail below with reference to the accompanying drawings and examples. The specific implementation examples described herein are only used to explain the present invention, but not to limit the present invention. In addition, for the convenience of description, only the parts related to the present invention are shown in the accompanying drawings, rather than all the contents.

[0037] Example: Figure 1 As shown in the figure, the optimization algorithm for accelerating the solution of the multi-degree-of-freedom human spring-concentrated mass model is shown. The human body model is divided into 5 parts, each of which has three degrees of freedom in the horizontal direction X, vertical direction Z and rotation θ. The entire model has 15 degrees of freedom. The proposed 15-degree-of-freedom human concentrated mass parameter model has 15 coupled non-homogeneous differential equations, which can be expressed in matrix form as:

[0038] M·ddX+C·dX+K·X=f K ·Z 0 +f C ·dZ 0

[0039] Where M, K and C are 15*15 mass matrix, spring stiffness matrix and damping coefficient matrix respectively; ddX, dX and X are 15*1 acceleration, velocity and displacement vectors respectively.k and f c is the 15*1 coefficient vector used to support the motion; dZ 0 and Z 0 is the velocity and displacement caused by external excitation. X represents the displacement X 1 , X 2 , X 3 ...X 15 ; dX represents the speed dX 1 、dX 2 、dX 3 …dX 15 ;ddX represents acceleration ddX 1 ,ddX 2 ,ddX 3 ……ddX 15 . This differential equation can be reduced to a first-order differential equation and we can obtain dX = A*(X, dZ 0 , Z 0 ) in the form of dX = A·X + b1·dZ 0 +b 2 ·Z 0 The flowchart of Runge-Kutta method (ode45) and fast algorithm is as follows Figure 2 shown.

[0040] Step 1: global ticks declares global variables to display the current calculation position. Let ticks = 0 to start from step 0.

[0041] Step 2: Load the acceleration curve and set up a MATLAB-based linear interpolation function to confirm the subsequent dZ 0 , Z 0 Is the acceleration result correct? And do trapezoidal integration on the acceleration curve in advance to get the speed curve dZ 0 , and then dZ 0 Do trapezoidal integration to get the displacement curve Z 0 .

[0042] Step 3: Create a symbol vector about X. Since the system state is X 1 , X 2 , X 3 ...X 30 , so the code is x=sym('X',[30,1]).

[0043] Step 4: Substitute the independent variables X and dZ 0 and Z 0 , find the symbolic expression of dX with respect to the independent variable, that is, dX = odefun([], X, sym('dZ 0 '), sym('Z 0 ')).

[0044] Step 5: Create a 30*30 Jacobian matrix A=sym(zeros(30)); then use a for loop to traverse each independent variable and find the partial derivative of dX with respect to each independent variable X to obtain A, that is, A(:, i)=diff(dX, X(i)); find the derivative of dX with respect to dZ 0 The partial derivative of b 1 That is b 1 =diff(dX,sym('dZ 0 ')); Find dX with respect to Z 0 The partial derivative of b 2 That is b 2 =diff(dX,sym('Z 0 ')).

[0045] Step 6: Use assert(all(double(A*X+b 1 .*sym('dZ 0 ')+b 2 .*sym('Z 0 ')-dX)==0)) assert dX=A·X+b1·dZ 0 +b 2 ·Z 0 .

[0046] Step 7: Convert A into a numerical matrix by A=double(A); use b 1 =double(b 1 ) 1 Convert to a numerical matrix; use b 2 =double(b 2 ) 2 Convert to a numeric matrix.

[0047] Step 8: Initialize the DY array, then iterate through each moment through a for loop, and then use DY(i,:)=odefun2(T(i),Y(i,:)',t 0 , dt, dZ 0 _, Z 0 _, A, b 1 , b 2 ) derive the DY value in odefun2; then use ref = odefun(T(i), Y(i,:)', dZ 0( T(i)), Z 0(T(i)))', get the reference value of the original odefun. Then assert(max(abs(DY(i,:)-ref)) / (max(max(abs(DY(i,:)), abs(ref)))+eps())<1e -10 ) to assert that the value output by odefun2 is within 1e of the value output by odefun -10 .

[0048] Step 9: Write an accelerated version of odefun, namely function dx = odefun2(t, X, t 0 , dt, dZ 0 _, Z 0 _, A, b 1 , b 2 );The calculation formula of odefun is dX=A·X+b1·dZ 0 +b 2 ·Z 0 ; Input: time t, state vector X, initial time t 0 , sampling interval dt, sampling vector dZ 0 , sampling vector Z 0 , coefficient matrix A, coefficient vector b 1 , coefficient vector b 2 . Output: state derivative dX / dt.

[0049] Step 10: Use the global variable global ticks to record the number of times odefun is run; ticks = ticks + 1 means the number of runs increases by one; use iffloor(ticks / 100000) == ticks / 100000 to indicate every 100000 calls. Then use disp(t) to output the current t value.

[0050] Step 11: Use index=(tt 0 ) / dt+1Find the number of rows in the sampling table at the current time t, round down to get the sampling at the earlier time, that is, i 1 =floor(index); round up to get the sample at a later time, that is, i 2 = ceil(index); the weight of the earlier sampling is 1-(the distance between the sampling point and time t), that is, w 1 =1-(index-i 1 ); The weight of the later sampling is 1-(the distance between the sampling point and time t), that is, w 2 =1-(-i 2 -index). If the row number index corresponding to the current moment is exactly 1, then w 1 =w2 , at this time ww=2; let w 1 =w 1 / ww;w 2 =w 2 / ww. Normalize the weight to w 1 +w 2 = 1. Then we can use dZ 0 =w 1 ·dZ 0 (i 1 )+w 2 ·dZ 0 (i 2 ) Linear interpolation to get dZ 0 (t); by Z 0 =w 1 ·Z 0 (i 1 )+w 2 ·Z 0 (i 2 ) Linear interpolation to get Z 0 (t); finally use the calculation formula dX = A·X + b1·dZ 0 +b 2 ·Z 0 Perform calculations.

[0051] Step 12: Write function dX = odefun(~, X, dZ 0 , Z 0 ) is the unaccelerated odefun, which is the fourth-order Runge-Kutta method. The calculation process is as follows Figure 2 As shown in Figure 2, the fast algorithm reaches the target value faster than the Runge-Kutta method in each iteration. Figure 3 As shown, the calculation speed will be faster. The calculated results are as follows Figure 4 As shown, the vertical acceleration of each body part in the real-person experiment in the prone position is compared. At the head, the error of the GeKutta method relative to the experiment is 4.7%, and the error of the fast algorithm is 3.7%; at the torso, the error of the GeKutta method relative to the experiment is 8.1%, and the error of the fast algorithm is 3.4%; at the pelvis, the error of the GeKutta method relative to the experiment is 2.6%, and the error of the fast algorithm is 0.6%; at the thigh, the error of the GeKutta method relative to the experiment is 3.6%, and the error of the fast algorithm is 1.0%; at the crus, the error of the GeKutta method relative to the experiment is 0.8%, and the error of the fast algorithm is 1.7%; the peak value of the acceleration at each position has a smaller error than that of the experiment and the RungeKutta method, which proves that the accuracy is higher.

Claims

1. An optimization algorithm for accelerating the solution of a multi-degree-of-freedom human spring-lumped mass model, characterized by: The human body model is divided into five parts, each of which has three degrees of freedom: horizontal X, vertical Z, and rotation θ. The entire model has 15 degrees of freedom. The proposed 15-degree-of-freedom human concentrated mass parameter model has 15 coupled non-homogeneous differential equations, which are expressed in matrix form as follows: M·ddX+C·dX+K·X=f K ·Z0+f C ·dZ0 Where M, K and C are 15*15 mass matrix, spring stiffness matrix and damping coefficient matrix respectively; ddX, dX and X are 15*1 acceleration, velocity and displacement vectors respectively; f k and f c is the 15*1 coefficient vector used to support motion; dZ0 and Z0 are the velocity and displacement caused by external excitation; X represents the displacement X1, X2, X3, ... X 15 ; dX represents the speed dX1, dX2, dX3...dX 15 ; ddX represents acceleration ddX1, ddX2, ddX3...ddX 15 ; Reduce the differential equation to a first-order differential equation to obtain the form of dX = A*(X, dZ0, Z0), that is, dX = A·X+b1·dZ0+b2·Z0; The specific steps include: Step 1: global ticks declares global variables to display the current calculation position. Let ticks = 0 to start from step 0; Step 2: Load the acceleration curve, and then set a function based on MATLAB linear interpolation to confirm whether the subsequent acceleration results of dZ0 and Z0 are correct; and perform trapezoidal integration on the acceleration curve in advance to obtain the velocity curve dZ0, and then perform trapezoidal integration on dZ0 to obtain the displacement curve Z0; Step 3: Create a symbol vector about X. Since the system state is X1, X2, X3...X 30 , so the code is x=sym('X',[30,1]); Step 4: Substitute the independent variables X, dZ0 and Z0, and find the symbolic expression of dX with respect to the independent variables, that is, dX = odefun([], X, sym('dZ0'), sym('Z0')); Step 5: Create a 30*30 Jacobian matrix A=sym(zeros(30)); then traverse each independent variable through a for loop, and find the partial derivative of dX with respect to each independent variable X to obtain A, that is, A(:, i)=diff(dX, X(i)); find the partial derivative of dX with respect to dZ0 to obtain b1, that is, b1=diff(dX, sym('dZ0')); find the partial derivative of dX with respect to Z0 to obtain b2, that is, b2=diff(dX, sym('Z0')); Step 6: Assert dX = A·X + b1·dZ0 + b2·Z0 through assert(all(double(A*X+b1.*sym('dZ0')+b2.*sym('Z0')-dX)==0)); Step 7: Convert A into a numerical matrix by A=double(A); convert b1 into a numerical matrix by b1=double(b1); convert b2 into a numerical matrix by b2=double(b2); Step 8: Initialize the DY array, then iterate through each moment through a for loop, and then derive the DY value in odefun2 through DY(i,:)=odefun2(T(i),Y(i,:)',t0,dt,dZ0_,Z0_,A,b1,b2); then derive the DY value in odefun2 through ref=odefun(T(i),Y(i,:)',dZ 0( T(i)), Z0(T(i)))', get the reference value of the original odefun; Then assert(max(abs(DY(i,:)-ref)) / (max(max(abs(DY(i,:)), abs(ref)))+eps())<1e -10 ) to assert that the value output by odefun2 is within 1e of the value output by odefun -10 ; Step 9: Write the accelerated version of odefun, i.e. function dx = odefun2 (t, X, t0, dt, dZ0_, Z0_, A, b1, b2); the calculation formula of odefun is dX = A·X+b1·dZ0+b2·Z0; input: time t, state vector X, initial time t0, sampling interval dt, sampling vector dZ0, sampling vector Z0, coefficient matrix A, coefficient vector b1, coefficient vector b2; output: state derivative dX / dt; Step 10: Use the global variable global ticks to record the number of times odefun is run; ticks = ticks + 1 means the number of runs increases by one; use iffloor(ticks / 100000) == ticks / 100000 to indicate every 100000 calls; then use disp(t) to output the current t value; Step 11: Use index = (t-t0) / dt+1 to find the number of rows in the sampling table at the current time t, round down to get the sampling at an earlier time, that is, i1 = floor(index); round up to get the sampling at a later time, that is, i2 = ceil(index); the weight of the sampling at an earlier time is 1-(the distance between the sampling point and the time t), that is, w1 = 1-(index-i1); the weight of the sampling at a later time is 1-(the distance between the sampling point and the time t), that is, w2 = 1-(-i2-index); If the row number index corresponding to the current moment is exactly 1 integer, then w1=w2, and ww=2; let w1=w1 / ww; w2=w2 / ww; normalize the weight to the state of w1+w2=1; at this time, dZ0(t) is obtained by linear interpolation through dZ0=w1·dZ0(i1)+w2·dZ0(i2); Z0(t) is obtained by linear interpolation through Z0=w1·Z0(i1)+w2·Z0(i2); finally, the calculation formula dX=A·X+b1·dZ0+b2·Z0 is used for calculation; Step 12: Write function dX=odefun(~, X, dZ0, Z0), which is the unaccelerated odefun, which is the fourth-order Runge-Kutta method.