Abstract
This article describes a procedure for enhancing computational accuracy in MATLAB’s Simulink and Simscape environments, as illustrated through specific example cases. It builds on earlier published by the authors’ team, which demonstrated the practical application of the Simscape Multibody tool—originally designed for dynamic and kinematic analyses—for making static computations in truss systems. Simscape Multibody serves as an effective platform for realistic and simplified simulations of mechanical components, incorporating various mechanical properties. Consequently, it is valuable in simulating mechatronic systems, where the integration of mechanics, electronics, control systems, and information technologies is essential. Multiple models were tested and analyzed across different scenarios to facilitate a comparative assessment of the results. The significance of this work lies in its achievement of highly accurate computational results without relying purely on theoretical calculations, with superior values in terms of accuracy. The primary objective was to provide a clear and practical description of a simple procedure for improving computational accuracy, based on scaling.
1. Introduction
This article builds upon our previous publication [1], which addressed the analysis of a truss system using MATLAB–Simscape Multibody [2,3] version 24.1.0.2628055 (R2024a) Update 4. It presents additional examples to further clarify and elaborate on this computational approach. The paper also provides a more detailed explanation of how an additional scaling [4] procedure can be utilized to enhance computational accuracy within the Simulink environment. To ensure the reliability of the simulation results, the system was also analyzed within the framework of Hooke’s law (linear elastic behavior). Due to the inherent complexity of such computations, particularly when dealing with more sophisticated structural systems, a range of software tools are typically employed. When the primary objective is to determine deformations and internal forces in components that may be part of a broader mechatronic system [5,6], Simscape Multibody proves to be a useful toolbox. It serves as a successor to the formerly used SimMechanics [7], which has been widely applied in mechanical simulations, as demonstrated in [8,9]. The approach described herein enables a notable increase in computational accuracy without significantly extending the simulation time. Using this approach, computational accuracy can be improved to the level of approximately 10−6. Our testing has also demonstrated that this approach can, to a certain extent, be applied more broadly across the Simulink platform. Most toolboxes already have scaling by Nominal Values [10] implemented.
While the Multibody toolbox does not constitute a fully fledged finite element analysis (FEA) tool—particularly with regard to large deformations, nonlinear material strength behavior, and overall computational capacity—it nonetheless offers considerable value to users operating within the Simulink environment, especially when integrating additional toolboxes. It allows users to avoid constructing excessively complex mechanical models. The Multibody library includes a set of components known as flexible bodies [3], which represent elements capable of elastic deformation under combined loading conditions, specifically tension, compression, bending, and torsion [11]. The stiffness and inertia of these bodies derive from their geometric and material properties. The computational principle applied to bars follows the Euler–Bernoulli beam theory [12] (pp. 174–220), which is suitable for modeling truss systems. The computational setup also includes the visualization of results based on user-defined input parameters. For comparative purposes, each example is accompanied by results obtained through analytical procedures. In this context, the term “bars” refers to structural members with uniform cross-sections, fixed at both ends via joints. The connection point of at least two such bars is defined as a node. It should also be noted that under compressive loading, buckling may occur [13] (pp. 483–507), resulting in a loss of stability and deflection of the bar through buckling from its original axis. This article does not address the assessment of buckling stability [14] in compression-loaded bars. For detailed analyses and theoretical background related to the stability of structures, the reader is referred to [15] (pp. 449–511).
Ultimately, the article deals in more detail with the explanation of a simple procedure for improving computational accuracy, using simplified scaling depending on a single input variable. Scaling by nominal values allows you to set the value of a variable for the solver in such a range that the dynamics of the calculation of all variables in a given system are matched. This increases the robustness of the simulation. The benefit is faster convergence of the solution and maintaining a minimum iteration step size. In Simscape Multibody™, there is no scaling system [10] in the sense that we know it for most Simscape toolboxes using nominal values. This can be solved by changing the proportion of the variable, but this may result in a change in the output values. If we do not want to change the number of parameters and adapt the model for numerical purposes, we only shifted the value of the input quantity. Due to this simple adjustment, it is of course not possible to maintain the calculation accuracy in the same class (10−6) with a dynamically changing input variable (in our case Fload m). But it is especially suitable for steady states. In our case, for example, for static calculations. The most effective is to use automatic solver selection. The software will use an algorithm to select the solver (method) and the maximum step size. We emphasize that this is not a description of a new method, but a better use of the potential of existing tools. For the input of the scaling procedure, we can simply write input{Fload m/con} and for the outputs{(F, N, δ) × con}. This procedure, which is used in the examples, can bring a benefit in terms of accuracy of about two orders of magnitude.
2. Illustrative Planar Examples
This section presents selected examples of truss systems, which are used to demonstrate methods for achieving maximum computational accuracy in Simscape Multibody. In each example, the models differ slightly in the type of bar employed and in the way in which the node is implemented. These variations are deliberate, as we will later examine how the toolbox handles the visualization of structural loading. The models are partially inspired by publicly available sources [16], which have been adapted for various configurations.
The first tested structure is the truss system shown in Figure 1. It consists of five nodes and seven bars, and is once externally statically indeterminate (see, e.g., [17], pp. 107–108).
Figure 1.
Example 1. A schematic of the truss system subjected to the force vector Fload at Node_4.
2.1. Example 1: Three Modeling Variants
A schematic of the truss system used in Example 1 is shown in Figure 1. The structure was experimentally modeled using three different approaches (models):
- Model 1.1 is composed of Euler–Bernoulli beams and joints.
- Model 1.2 serves as an experimental variant. It also employs Euler–Bernoulli beams, but it uses solid joints. This configuration does not conform to the assumptions of the theoretical model, as the nodes do not incorporate movable joints.
- Model 1.3 consists of rigid bars with one degree of freedom (1 DOF) and joints. This model most closely resembles the conventional standards used in static structural analysis software.
The truss system is subjected to a force vector applied at Node_4. All bars have identical cross-sections.
2.1.1. Model 1.1: Truss System Composed of Euler–Bernoulli Beams and Joints
Model 1.1, constructed in Simscape Multibody, is depicted in Figure 2. The same block structure is used for Model 1.2 and Model 1.3. All functional models are available at [18].
Figure 2.
Models 1.1, 1.2, and 1.3. The truss system subjected to the force vector Fload at Node_4, modeled in MATLAB–Simscape Multibody as defined in Figure 1.
Figure 3 illustrates the subsystem of a truss bar, based on the Bernoulli beam model. Only axial force is considered. All truss bars in simulation Model 1.1 and Model 1.2 are identical in structure and constructed as follows:
Figure 3.
Models 1.1 and 1.2. An example of a truss bar subsystem, labeled Beam_1.
Blocks of the “Rigid Transform” type are used to rotate the truss bar into the desired plane about the y–axis of the World Frame. The value of the force vector N1 is obtained directly from the “Weld Joint” block using Total force sensing. The “Interpreted MATLAB Function” block—specifically, its output u(3)—extracts the z-component of the force vector N1 acting within the bar. Although the manufacturer recommends using “User-Defined Functions” [19] (p. 344) or their online counterparts [20], in order to improve computational speed, we have chosen the “Interpreted MATLAB Function” block, due to its greater flexibility in parameter syntax. The block that physically represents the truss bar, labeled Beam, is of the type “Flexible Cylindrical Beam”. Within this block, key physical parameters are specified: the bar length l, the diameter d, the Young’s modulus of elasticity E, the shear modulus G, the material density (Density), and the coefficients of proportional Rayleigh damping [21], denoted as bm and bk.
Figure 4 illustrates the subsystems by node in Model 1.1 and Model 1.3. While structurally similar, each node exhibits differences in configuration and in the specification of the initial position state (in radians). All nodes are constructed using joints.

Figure 4.
Model 1.1 and Model 1.3. Subsystems by node: (a) Node_1; (b) Node_2; (c) Node_3; (d) Node_4; (e) measurement of the Fload m force at Node_4; (f) Node_5.
The Fload m force essentially serves as a means of verifying the computed Fload force. It is derived from the internal forces within the system, specifically based on the equilibrium conditions at Node_4.
The Fload force represents the external load applied to the system. In cases where multiple external forces act on the system, the one with the highest magnitude is selected for validation purposes.
2.1.2. Model 1.2: Truss System Composed of Euler–Bernoulli Beams and Solid Joints
The truss system defined as Model 1.2, constructed in Simscape Multibody, features the same block configuration as shown in Figure 2. The only distinction lies in the implementation of the nodes.
Figure 5 illustrates the subsystems by node in Model 1.2. Each node differs in its configuration and initial position state (in radians). The nodes are composed of solid joints.

Figure 5.
Model 1.2. Subsystems by node: (a) Node_1; (b) Node_2; (c) Node_3; (d) Node_4; (e) measurement of the Fload m force at Node_4; (f) Node_5.
As in the previous case, the Fload m force is derived from the equilibrium conditions at Node_4, as expressed in Equations (1) and (2). However, this interpretation is not entirely accurate in this context, since the nodes do not incorporate movable joints. Nevertheless, it is sufficient for the intended purpose.
2.1.3. Model 1.3: Truss System Composed of Solid Bars with One Degree of Freedom (1 DOF) and Joints
Model 1.3 of the truss system, constructed in Simscape Multibody, employs the same block configuration as shown in Figure 2. The nodes are constructed identically to those in Model 1.1, as illustrated in Figure 4. The only difference lies in the structural implementation of the bars.
Figure 6 illustrates the subsystem of a truss bar, which consists of two rigid bodies connected by a prismatic joint with one degree of freedom (1 DOF). The joint defines a stiffness parameter k with a value of ES/l, damping b, and an initial position set to zero. All the truss bars in the simulation model—Model 1.3—share an identical structure and are constructed as follows:
Figure 6.
Model 1.3. An illustration of the bar subsystem named Beam_1. The subsystem comprises two solid bodies connected by a prismatic joint with one degree of freedom (1 DOF).
The measurement of nodal displacements δ follows the same principle across all models (Model 1.1, Model 1.2, and Model 1.3). The only difference lies in the (x, y) positioning of the nodes; therefore, only one representative example is shown. Figure 7 presents the subsystem named Node_Deflection_4.
Figure 7.
Model 1.1, Model 1.2, and Model 1.3. A detailed view of the deflection measurement subsystem labeled Node_Deflection_4 at coordinates x = −L/2, y = −H.
“Transform Sensor”—Translation [x, y, z] are employed to measure the displacement relative to the World Frame. The remaining blocks are used to isolate the vector components x, y corresponding to displacement in the plane relative to the original position.
Figure 8 presents the subsystem responsible for applying the external load Fload, including its proportional correction via a multiplication constant con. This configuration is identical across all models (Model 1.1, Model 1.2, and Model 1.3).
Figure 8.
Model 1.1, Model 1.2, and Model 1.3. The subsystem under application of the external load Fload, including its proportional adjustment via the multiplication constant con.
2.2. Example 2: Three Modeling Variants
Figure 9 presents a schematic of the second truss system. The structure is also experimentally modeled using three different approaches:
Figure 9.
Example 2. A schematic of the truss system subjected to a force vector Fload at Node_11.
- Model 2.1 consists of Euler–Bernoulli beams and joints.
- Model 2.2 is primarily experimental. It is composed of Euler–Bernoulli beams and solid joints. This model does not satisfy the assumptions of the theoretical model, as the nodes do not contain movable joints.
- Model 2.3 comprises solid bars with one degree of freedom (1 DOF) and joints.
The truss system is subjected to an external load applied at Node_11. All bars have an identical cross-section.
2.2.1. Model 2.1: Truss System Composed of Euler–Bernoulli Beams and Joints
Model 2.1, implemented using Simscape Multibody, is presented in Figure 10. The fully assembled functional models are available in [18]. The same block configuration is applied in both Model 2.2 and Model 2.3.
Figure 10.
Model 2.1, Model 2.2, and Model 2.3. The structure of the truss system subjected to the force vector Fload at Node_11, implemented in MATLAB–Simscape Multibody, based on the schematic shown in Figure 9.
The truss bar subsystem, based on the Euler–Bernoulli beam model, is analogous to the configuration used in Model 1.1 and Model 1.2 (see Figure 3), and follows the same modeling principles. All the truss bars have an identical structural composition, and only axial force is taken into account.
Figure 11 presents the primary sections, i.e., subsystems of the structure, including those repeated throughout the model. All the components associated with the nodes are consistently labeled as Node_1, Node_2, and so forth.
Figure 11.
Model 2.1 and Model 2.3. Subsystem types by section: (a) Section_1; (b) Sections_2 to _4 are conceptually identical; (c) Sections_5 to _6 are conceptually identical.
The control measurement of the load force Fload m is depicted in Figure 12.
Figure 12.
Model 2.1, Model 2.2, and Model 2.3. Measurement of the Fload m force in Section_6.
The load force Fload m also serves here as a control verification of the computed load force Fload. The value of Fload m is derived from the internal forces within the system, specifically from the equilibrium condition at Node_11.
The Fload force represents the external load applied to the system. In cases where multiple external forces act on the structure, the one with the maximum magnitude is selected for control measurement.
2.2.2. Model 2.2. Truss System Composed of Euler–Bernoulli Beams and Solid Joints
The block configuration of Model 2.2, constructed in Simscape Multibody, is identical to the configuration shown in Figure 10. The only difference lies in the implementation of the nodes.
The subsystem of the truss bar, based on the Euler–Bernoulli beam model, is analogous to that used in Model 1.1 and Model 1.2 (see Figure 3). The same modeling principles apply. All truss bars in the simulation are structurally identical, and only axial force is considered.
The subsequent illustration, Figure 13, presents the primary structural sections—the subsystems that define the construction and those that are repeated. All the elements associated with the nodes are labeled consistently as Node_1, Node_2, etc. Section_1, shown in Figure 11a, remains the same across Model 2.1, Model 2.2, and Model 2.3.
Figure 13.
Model 2.2. The conceptual structure of the subsystems by section: (a) Sections_2 to _4 share an identical configuration; (b) Sections_5 to _6 are conceptually identical.
The control measurement of the load force Fload m is identical to that in Model 2.1, as shown in Figure 12. Equations (3) and (4) apply. However, this interpretation is not entirely accurate in this particular case, as the nodes do not contain movable joints. Nevertheless, it is sufficient for the intended purpose.
2.2.3. Model 2.3. Truss System Composed of Solid Bars with 1 DOF and Joints
The configuration of Model 2.3, assembled in Simscape Multibody, has the same block structure as that shown in Figure 10. The only difference lies in the representation of the bars, which is analogous to that used in Model 1.3; see Figure 6. The bar consists of two rigid bodies connected by a prismatic joint with one degree of freedom (1 DOF). Within the joint, the stiffness k is defined as ES/l, along with the damping b and the initial position set to zero. All the truss bars in the simulation model (Model 2.3) have an identical structure.
The measurement of node displacements is consistent across all three models (Model 2.1, Model 2.2, and Model 2.3); the nodes differ only in their (x, y) locations. The concept is identical to that for the structure shown in Figure 7.
The subsystem used to define the Fload force is identical to that shown in Figure 8, and is shared by all three models (Model 2.1, Model 2.2, and Model 2.3).
3. Computational Optimization Procedure
The optimization consists of identifying the appropriate input level—specifically, the value of the ratio Fload/con for a given model—at which the computational accuracy is maximized. The gain in precision can reach two to three orders of magnitude. The resulting values will be compared against the theoretical solutions obtained for Models 1.1, 1.2, and 1.3, and against the more complex structures represented by Models 2.1, 2.2, and 2.3. Additionally, a more complex test configuration derived from Model 1.1 will be evaluated to further assess its potential for improving the accuracy larger structural systems, considering both computational precision and processing time. The optimization is performed by applying a stepwise change (scaling) in the proportionality constant con. Alternatively, a dynamic adjustment of con based on the difference between Fload and Fload m may be implemented. In such cases, the value of con is determined proportionally to Fload. Suitable computational solvers for this type of simulation within the toolbox include ode15s, ode23s, ode23t, and ode23tb (see [22] for further details). Among these, ode15s was selected for its proven reliability and computational efficiency. Another option for stiff systems is also solvers ode23s, ode23t, and ode23tb. The solvers ode45, ode23, and ode113 are not recommended for stiff systems (longer computational times).
The following Procedure 1 describes a simple algorithm for selecting the control measurement of the load force F_load_m. The entire set of measurements indexed by i is divided into time sequences, denoted as Sequence, with a total number k. During each sequence, the data F_load_m_separ_k is selected outside the transient state Lag, caused by the natural vibration delay of the system. That is, to process the mean value Mean_F_load_m(k) from the given measurement sequence, data from the steady-state condition is used. This continues until a step change in the F_load_m force occurs, at which point the end of the sequence yields undesired results. These are separated in advance using Lead. The proportionality of the step change in the load force F_load_m is realized using the multiplication constant con. Additionally, the maximum Max_F_load_m(k) and minimum Min_F_load_m(k) are computed for each sequence.
The results are subsequently visualized in the plot F_load_m = function(con), as shown in Figure 14, Figure 15 and Figure 16. The closer the value of F_load_m is to the applied force F_load, the more accurate the computation is, provided that the variation in F_load_m remains minimal. If the variation in F_load_m exceeds the maximum and minimum values observed in the preceding sequence, the resulting error may increase (depending on the sample). In such cases, it is not meaningful to proceed with the computation.
| Procedure 1: Visualization of the computational accuracy of Fload m as a function of con | |
| Input: multiplication constant con, vector of load force F_load, control measurement of the load force F_load_m, simulation sequence duration SampleTime, measurement sequence (Sequence), end of simulation StopTime, vector of sequences Seq_vector, Lag, Lead, sequence step k, ith sample of the F_load_m variable. | |
| Output: Sorted values F_load_m_separ_k, maxima of the measured values for the given sequence Max_F_load_m(k), minima of the measured values for the given sequence Min_F_load_m(k), mean of the measured values for the given sequence Mean_F_load_m(k), time for all sequences TIME{k}. | |
| 1 | For k = 1 to size(Seq_vector) do |
| 2 | If k < size(Seq_vector) then |
| 3 | For i = 1 to size(F_load_m) do |
| 4 | If ((Seq_vector(k)-Lag) ≤ F_load_m(i)) & (F_load_m(i) ≤ (Seq_vector(k+1)-Lead)) |
| 5 | F_load_m_separ (i) ← F_load_m (i) |
| 6 | End |
| 7 | End |
| 8 | F_load_m_separ_k← F_load_m_separ |
| 9 | clear F_load_m_separ—delete previous values |
| 10 | F_load_m_separ_1 = F_load_m_separ_k(1,:)—force vector extracted from matrix F_load_m_separ_k for the sequence |
| 11 | F_load_m_separ_2 = F_load_m_separ_k(2,:)—time vector extracted from matrix F_load_m_separ_k for the sequence |
| 12 | A{k} = F_load_m_separ_1(F_load_m_separ_1 ~=0)—exclusion of invalid values |
| 13 | Max_F_load_m(k) = max(A{k})—maxima of F_load_m_separ_k |
| 14 | Min_F_load_m(k) = min(A{k})—minima of F_load_m_separ_k |
| 15 | Mean_F_load_m(k)—mean values computed from F_load_m_separ_ 1 |
| 16 | time = F_load_m_separ_2 (F_load_m_separ_2 ~= 0)—exclusion of invalid time values for the sequence |
| 17 | TIME{k}—all time sequences |
| 18 | Else |
| 19 | End |
| 20 | End |
Figure 14.
The computational accuracy of the control measurement of the load force Fload m. The closer the value of Fload_m is to the force F_load, the more accurate the computation is, provided that the swing of Fload_m values remains minimal: (a) Model 1.1; (b) Model 1.2; (c) Model 1.3.
Figure 15.
The computational accuracy of the control measurement of the load force Fload m. The closer the value of F_load_m is to the force F_load, the more accurate the computation is, provided that the swing of F_load_m values remains minimal: (a) Model 2.1; (b) Model 2.2; (c) Model 2.3.
Figure 16.
The computational accuracy of the control measurement of the load force Fload m for Example 3. This represents a test computation of a more complex structure consisting of 39 bars, created based on Model 1.1 from Example 2. The closer the value of F_load_m is to the force F_load, the more accurate the computation is, provided that the swing of F_load_m values remains minimal: (a) bar diameter d = 0.01 m; (b) bar diameter d = 0.1 m.
The output plots below illustrate the computational accuracy of the control measurement of the load force Fload m as a function of the proportionality constant con for (a) Model 1.1, (b) Model 1.2, and (c) Model 1.3.
The output plots below illustrate the computational accuracy of the control measurement of the load force Fload m as a function of the proportionality constant con for (a) Model 2.1, (b) Model 2.2, and (c) Model 2.3.
The output plots below illustrate the computational accuracy of the control measurement of the load force Fload m as a function of the proportionality constant con. A more complex test variant, created based on Model 1.1 from Example 2, was used. A total of 39 bars were implemented.
The results indicate that for different multiples of the load force vector Fload, the computational accuracy also varies. A similar situation occurs when other parameters are changed, such as the bar diameter, Young’s modulus, or similar material properties. Our objective was to investigate all factors influencing this computation and to explore how such optimization could be standardized for future analyses. In the script “Dependence_Floadm_on_con.m” [18], we initially planned to calculate the standard deviation [23] in addition to the mean and extreme values; however, this approach proved to be impractical for the following reasons:
- The computation did not consistently conform 100% to the theoretical probability of the Gaussian distribution [24]. For example, instead of the expected 99.73% probability set, the actual result was 98.98%.
- During the computation, the simulation can be interrupted at any moment. As a result, no samples are excluded, and calculating the standard deviation does not provide meaningful insight in this context. Consequently, even samples that fall outside multiples of the standard deviation interval remain included in the data set. Therefore, we opted to use the actual maxima and minima derived from the given set of values.
4. Results
Analytical solutions were obtained using publicly available scripts from [25] for various truss systems analyzed through Matrix Structural Analysis in the MATLAB environment. Essentially, these involve two-dimensional problems derived from the principles of the Finite Element Method (FEM) [26] or, for example, [27] (pp. 141–143). Specific examples were selected or created for testing in Simscape Multibody, with the aim of achieving the highest possible computational accuracy. Additionally, we were interested in exploring how load visualization can be implemented in this toolbox. Load visualization is a representation of a system with bars deformation due to load (Figure 17 and Figure 18). Within each example, the individual models differ slightly, either in the configuration of the bars or in the design of the nodes.
Figure 17.
Deformed state visualization across the models: (a) Model 1.1; (b) Model 1.2; (c) Model 1.3 (Young’s modulus E reduced by three orders of magnitude); (d) two physical models with cross-sectional areas of S1 = 1.1309 mm2 and S2 = 0.3848 mm2.
Figure 18.
Visualization of the deformed state in the structural models: (a) Model 2.1; (b) Model 2.2; (c) Model 2.3 (Young’s modulus, E, reduced by three orders of magnitude); (d) Two physical structures with different cross–sectional areas of the bars, S1 = 1.5393 mm2 and S2 = 0.7853 mm2.
The outputs from Models 1.1, 1.2, and 1.3 in Example 1, as well as Models 2.1, 2.2, and 2.3 in Example 2, obtained through simulations in MATLAB–Multibody and from theoretical calculations, are summarized in the following tables: Table 1 and Table 2. These outputs also include visualizations of the deformed state. Additionally, Table 3 presents a case involving an extended version of Model 1.1 with a larger number of bars. For this extended model, analytical solution formulas were not included; the results are provided only in numerical form.
Table 1.
A comparison of the theoretical results for forces N1–N7 acting in the bars, forces F1, F3 (not reactions) at the supports of Node_1 and Node_3, and the deflections δ2, δ4, and δ5, with the results from the individual models Model 1.1, Model 1.2, and Model 1.3 constructed in MATLAB–Multibody. The simulation time for the optimal con ranges from 2 to 5 s. Hardware configuration: processor i9–10900, 2.8 GHz, 32 GB RAM, MATLAB 2024a, 64-bit. The same solver (ode15s) was used across all models, with identical settings for absolute and relative tolerances (10−3) and a maximum iteration step of 0.01 within a variable step.
Table 2.
A comparison of the theoretical results for the forces N1–N21 acting in the bars, forces F1 and F2 (not reactions) at the supports of Node_1 and Node_2, and displacements δ2–δ12. These results are compared with those obtained from Models 2.1, 2.2, and 2.3 simulated in MATLAB–Multibody. The simulation time for the optimal con value ranged from 10 to 22 s. The calculations were performed on a processor i9–10900, 2.8 GHz, with 32 GB RAM, using MATLAB 2024a, 64-bit. The same solver (ode15s) and identical settings for absolute tolerance, relative tolerance (10−3), and the maximum iteration step (0.01) within the variable–step configuration were used throughout.
Table 3.
Example 3. A comparison of the theoretical results for forces N1–N39 acting in the bars, as well as forces F1L, F20R (not reactions) at the supports of nodes Node_1 and Node_20, and deflections δ2–δ19 and δ21, with the results from the MATLAB–Simscape Multibody model. The simulation time for the optimal value of con was 94 s. Hardware specifications: Processor i9–10900, 2.8 GHz, 32 GB RAM, Matlab 2024a, 64-bit. The same solver (ode15s) was used, with identical settings for absolute and relative tolerances (10−3), and a maximum iteration step size of 0.01 within a variable step.
4.1. Results for Example 1
4.1.1. Theoretical Calculation for Example 1: Three Modeling Variants
Table 1 summarizes a comparison of the individual results for Models 1.1, 1.2, and 1.3 obtained from MATLAB–Multibody and from the theoretical calculation.
The following analytical expressions were obtained from the symbolic computation performed for Example 1. The force vectors, which do not represent reactions, at the supports of Node_1 and Node_3 are calculated as follows:
The forces in the bars are derived as follows:
The displacement vectors δ of the node displacements Node_2, Node_4, and Node_5 are calculated as follows:
For all modeling variants—Model 1.1, Model 1.2, and Model 1.3—the force vector Fload = [Fx, Fy]T has the numerical value Fload = [2, 10]T kN. The lengths of the bars are determined by the distances between the nodes or by the dimensions of the system, with L = 1 m and H = L∙cos(π/6) m. The bars have identical diameters of d = 0.01 m. The Young’s modulus E is 210 GPa.
For Models 1.1 and 1.2, the shear modulus G is 79 GPa, and the material density (Density) is 7800 kg/m3. Poisson’s ratio is 0.28. The values for proportional (Rayleigh) damping are kept at their default settings for practical purposes, with bm = 0.01 s−1 and bk = 0.01 s. Essentially, these values can be set to nearly zero. The damping at the supports is brj = 1 N∙m∙s∙rad−1.
For Model 1.3, the damping at the supports is brj = 6∙104 N∙m∙s∙rad−1. The damping in the bars is b = 10 N∙s∙m−1. The axial stiffness of the bars under tension/compression is defined as k = E∙π∙d2∙(4∙l)−1 N∙s∙m−1.
4.1.2. Results for Example 1: Theoretical Calculation and MATLAB Models
For clarity, the results are presented in the Table 1, with the theoretical calculations listed first, followed by those from the individual models.
After optimization, Model 1.1 achieved guaranteed accuracy up to six decimal places compared to the theoretical model. Model 1.3 performed similarly. Model 1.2 attained guaranteed accuracy of approximately two to three decimal places, despite not fulfilling the assumptions of the theoretical model. In its nodes, there are no movable joints.
4.1.3. Results for Example 1: Visualization of the Deformed State of the Models
The visualization of the deformed state was performed for a specified norm of the displacement vector, ||δ4|| = 0.1 m, at Node_4; see, for example, Figure 1. This value is not critical, and serves solely to produce an exaggerated depiction of the deformation in theoretical models. For the material used in the physical model, copper (Cu) was selected due to its favorable ductility and plasticity. The bars had uniform diameters within each sample: da = 1.2∙10−3 m in the first case and db = 0.7∙10−3 m in the second. The dimensions were L = 40∙10−3 m, H = L∙cos(π/6) m. The model was constructed exclusively for the purpose of testing excessive deformation. In the theoretical models, the material was not changed, as it did not influence the resulting deformed shape.
For Model 1.3, the stiffness of the bars under uniaxial tension/compression needs to be reduced by approximately three orders of magnitude, calculated as k = 10−3∙E∙π∙d2∙(4∙l)−1 N∙s∙m−1.
The various models exhibit differences in the excessively deformed state when compared to the physical structure shown in Figure 17d. The best agreement with the physical structure was achieved by Model 1.1 in Figure 17a and Model 1.3 in Figure 17c. In the physical structure, the results are influenced by manufacturing precision and the method of applying support and load. Model 1.1 provided even better agreement when lower damping values brj were applied in the joints at the supports, combined with higher damping coefficients bk in the bars. This allowed the force effect from the load point to be transmitted more effectively throughout the structure. However, this model entailed the disadvantage of increased computational time required for analysis.
4.2. Results for Example 2
4.2.1. Theoretical Calculation for Example 2: Three Modeling Variants
Table 2 above compares the theoretical calculation with the results obtained from Models 2.1, 2.2, and 2.3 developed in MATLAB–Multibody.
The following analytical expressions were obtained from the symbolic computation performed for Example 2. The force vectors, which do not represent reactions, at the supports of Node_1 and Node_2 are calculated as follows:
The forces in the bars are determined as follows:
The displacement vectors δ of the movable nodes, from Node_2 to Node_12, are determined as follows:
For all modeling variants—Model 2.1, Model 2.2, and Model 2.3—the force vector Fload = [Fx, Fy]T has the numerical value Fload = [0, 10]T kN. The lengths of the bars are determined by the distances between the nodes or by the geometric dimensions of the system, with L = 1 m and H = 1 m. The bars all have the same diameter, d = 0.01 m. The Young’s modulus E is 210 GPa.
For Models 2.1 and 2.2, the shear modulus G is 79 GPa, and the material density (Density) is 7800 kg/m3. Poisson’s ratio is 0.28. The values for Rayleigh damping are kept at their default settings for computational convenience, with bm = 0.01 s−1, bk = 0.01 s. These values can essentially be considered nearly negligible. The damping in the supports is brj = 1 N∙m∙s∙rad−1.
In Model 2.3, the support damping is brj = 103 N∙m∙s∙rad−1, while the bar damping is b = 102 N∙s∙m−1. The axial stiffness for tension/compression in the bars is k = E∙109∙π∙d2∙(4∙l)−1 N∙s∙m−1.
4.2.2. Results for Example 2: Theoretical Calculation and MATLAB Models
For clarity, the results are presented in the Table 2, with the theoretical calculations listed first, followed by those from the individual models.
After optimization, Model 2.1 achieved consistent accuracy of up to five or six decimal places when compared with the theoretical model, except for values equaling zero. Model 2.3 exhibited similarly high accuracy. Model 2.2, despite not meeting the assumptions of the theoretical model, achieved an accuracy of up to approximately two decimal places. This is because there are no movable joints in the nodes.
4.2.3. Results for Example 2: Visualization of the Deformed State of the Structures
Visualization of the deformed state was performed for a specified norm of the displacement vector, ||δ11|| = 0.1 m, at Node_11 (see, e.g., Figure 9). This value is not critical and serves solely to exaggerate the deformation in the theoretical models for illustrative purposes. For the physical structure, copper (Cu) was selected as the material due to its favorable ductility and plasticity. The diameters of the bars were kept constant within each sample, with values of da = 1.4∙10−3 m and db = 1∙10−3 m. The dimensions were set as H = 40∙10−3 m and L = 40∙10−3 m. The model was constructed exclusively as a test for excessive deformation. In the theoretical models, the material was not changed, as this had no impact on the resulting deformed shape.
For Model 2.3, it was necessary to reduce the axial stiffness of the bars in tension/compression by approximately three orders of magnitude, calculated as k = 10−3∙E∙π∙d2∙(4∙l)−1 N∙s∙m−1.
The differences between the structural models and the physical structure depicted in Figure 18d are also evident in the state of excessive deformation. Model 2.3, shown in Figure 18c, offers a good geometric approximation of the deformation shape. For the physical structure, the results are influenced by manufacturing precision and the method of fixation, both at the load application point and at the supports. Models 2.1 in Figure 18a and 2.2 in Figure 18b produced a closer match when lower damping values were assigned to the joints at the supports brj and higher damping coefficients were used in the bars bk. This enabled a more effective transmission of the load effect from the point of application throughout the rest of the structure. However, this came at the cost of increased computational time.
4.3. Results for Example 3: Test Calculation of a More Complex Structure Based on Example 2
Based on the positive results obtained in the previous examples, we selected a model in which the system consists of Euler–Bernoulli beams and joints. The aim was to test computational accuracy and, in particular, the required simulation time for a more complex structure in a theoretical context without a physical structure. This example will be available in [18]. And its sketch is in Figure 19.
Figure 19.
Example 3. Schematic of the truss system structure subjected to the force vector Fload at Node_3, comprising 39 bars and 21 nodes.
The system is essentially composed of a prototype subsystem that generally includes bars modeled as Euler–Bernoulli beams and joint nodes labeled 1, 2, 3, and 4. The last node has no further continuation, as it represents the end of the structure.
The force Fload m serves as a verification check of the computed force Fload. The force Fload m is derived from the forces within the system, specifically from the equilibrium at Node_3 in Subsystem 1; see Figure 20.
Figure 20.
Example 3. Model comprising Euler–Bernoulli beams and joint nodes. Truss system structure subjected to the force vector Fload at Node_3, Subsystem 1. Created in MATLAB–Simscape Multibody based on the schematic in Figure 19.
The force Fload represents the external load acting on the system. In cases where multiple external forces are applied to the system, the maximum force is selected for the control measurement. For clarity, symbolic calculations are no longer included at this stage; instead, the individual results are organized in a table. First, the theoretical calculation is presented, followed by the results obtained from the model.
The model, after optimization, achieved an accuracy consistent with that of the theoretical model up to six decimal places. A visualization of the deformed state was performed for a defined norm of the displacement vector ||δ3|| = 0.1 m at Node_3. This value is not critical, and is used solely for an exaggerated display of the deformation. See Figure 21.
Figure 21.
Visualization of the deformed state of the model for Example 3.
In this simulation, the computational time increased; however, the level of accuracy was maintained. The numerical computation conditions for all models in Example 1, Example 2, and Example 3 were identical. The same solver (ode15s) was used, along with consistent settings for the absolute tolerance (10−3), relative tolerance (10−3), maximum iteration step (0.01), within a variable step.
5. Discussion
During simulations in Simulink and Simscape models, certain differences in computational accuracy arise when the levels of input quantities are varied. These differences can naturally be addressed in “Model Settings–Solver” [19] (pp. 311–319) or the online aid [28] by imposing stricter requirements on parameters such as “Max step size”, “Absolute tolerance”, and “Relative tolerance”, either with respect to zero or relative to previous iterations. For the computations involving the given truss systems, where a static problem was analyzed, the recommended solvers ode15s, ode23s, ode23t, and ode23tb were used for so-called stiff problems. These solvers exhibit significantly higher speed compared to methods designed for nonstiff problems, such as ode45, ode23, or ode113. Another interesting approach that can be taken to further improve computational accuracy involves adjusting the proportionality (scaling) of the input quantity in the system, whether the system under analysis is a static structure, as in our case, or another type of system. Based on this proportionality, it is sufficient to identify a known quantity within the system (in our case, Fload) and redefine it based on the computational outputs (i.e., Fload m). For the simplest evaluation of output quantities, we opted for implementing step changes in proportionality using the multiplier constant con within individual sequences. Data representing steady-state values were isolated using a time Lag and Lead to exclude transient responses, which would otherwise distort the output value of Fload m. Figure 14, Figure 15 and Figure 16 clearly demonstrate that the accuracy of the computation varies depending on the level of the load force Fload. The optimum is achieved when the mean value of Fload m closely matches Fload while maintaining minimal swing. For example, if, for a given sequence k, the mean value of Fload m is closer to Fload, but the swing is large enough to extend into the mean calculated in sequence (k−1), then the probability of the calculation being accurate is not 100%. We observed that this proportionality cannot be easily generalized for all systems. It depends on numerous parameters of the system. If parameters such as the diameter of the bars or the Young’s modulus are altered, the optimal setting for the computation also changes. Regarding damping, the coefficients were selected to be the minimum necessary. For bars subjected to Rayleigh damping, the default values of bm and bk were retained, as they can essentially be nearly negligible. This is because very small increments of deformation are considered, which are proportionally scaled. In the case of solid bars, the damping coefficient b and the damping of supports brj were only increased to the level necessary to suppress undesirable transient responses during the computation.
The examples are divided into models that differ in their types of nodes and bars. The aim was to assess their influence on static analysis and the visualization of deformation. The models constructed from Euler–Bernoulli beams or from solid bars with one degree of freedom (1 DOF) and joints delivered the best results when compared with the theoretical model, as shown in Table 1, Table 2 and Table 3. However, it should be noted that models with solid bars and one DOF are generally unsuitable for dynamic simulations due to the non-uniform distribution of mass elements along the length of the bar. Models using locked joints may, in some cases (such as welded joints), reflect physical reality, but they show lower agreement with the theoretical model. This discrepancy arises because the direction of internal forces in the bars changes during deformation, a behavior that conventional joints can accommodate. For visualizing deformation, physical structures composed of copper elements were deliberately created due to copper’s excellent ductility (see Figure 17d and Figure 18d). These structures were deformed between two holding plates to prevent undesired buckling along the z–axis. Models 1.3 and 2.3 (see Figure 17c and Figure 18c) exhibited the fastest computations and provided a good approximation of the deformed shape. The time required for the calculation depends on the number of system elements. See Figure 22.
Figure 22.
The calculation depends on the number of system elements.
Models 1.1 and 2.1 (Figure 17a and Figure 18a) also achieved accurate shape approximations when higher levels of Rayleigh damping were applied to the bars, albeit at the cost of significantly longer computational times. The final extended model depicted in Figure 19 was developed specifically to test the precision and computational speed for more complex structures.
6. Conclusions
This article provides a comprehensive explanation of a fundamentally simple approach to enhancing computational accuracy within the Simulink environment. It builds on previous work and explores the potential of utilizing built-in tools available as part of the software package employed in our research. Our interest lay in assessing the results in terms of accuracy and determining the extent to which the simulations in Simulink deviated from theoretical calculations. Although this may represent an extreme requirement in terms of precision, its scaling offers a viable means of improving computational accuracy.
As discussed in Section 5, the examples are categorized into models differing in their types of nodes and bars. The aim was to investigate their influence on computational accuracy and deformation visualization in order to identify the optimal model in terms of theoretical calculations and, where applicable, visualization. From a computational standpoint, the model composed of Euler–Bernoulli beams and joints proved to be the most suitable, and it is also appropriate for dynamic simulations. However, regarding the visualization of extreme deformations, the results were not as clear-cut as in the case of computational analyses. It is therefore not possible to definitively identify a single model as the most suitable in this context. It should also be noted that the physical structures themselves were not perfect either, considering aspects such as the precision of node placement within the system, their mechanical implementation, structural strength, material quality, and similar factors. Additionally, the ratio of the length of the bar to its cross-section played a significant role in the collapse behavior of the physical truss structure. Two physical structures were experimentally constructed, each using bars of different diameters. Under the specified dimensions, working with a smaller cross-section proved more advantageous during loading. For more complex structures, the required computational time increased even though the desired level of accuracy was maintained.
Author Contributions
Drafting of concept and theoretical analysis: Š.O.; model design and data processing in MATLAB: Š.O.; overview, supervision, and approval: J.S. (Jozef Svetlík); project administration and methodology: J.S. (Jozef Svetlík), R.J., J.S. (Ján Semjon), M.S., T.S., and P.M. All authors have read and agreed to the published version of the manuscript.
Funding
This paper was prepared with the support of the grant project KEGA 043TUKE–4/2024—Creation of prospective educational tools for the field of additive manufacturing with the implementation of progressive elements of virtual reality, and VEGA 1/0215/23—Research and development of robotic workplaces equipped with industrial and collaborative robots.
Data Availability Statement
The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.
Abbreviations
The following abbreviations are used in this manuscript:
| FEA | Finite Element Analysis |
| FEM | Finite Element Method |
| DOF | Degree Of Freedom |
| Fload | Load force vector |
| Fload m | Control measurement of load force vector |
| N, N | Vector, component of normal force acting on the bar |
| F, F | Vector, component of the force (not a reaction force) acting on the support |
| l | Bar length, unless specified otherwise |
| L | Distance between nodes in the x–axis direction |
| H | Distance between nodes in the y–axis direction |
| d | Bar diameter |
| S | Bar cross-section |
| E | Young’s modulus describing the bar’s elasticity |
| G | Shear modulus |
| Density | Material density |
| μ | Poisson’s ratio |
| δ, δ | Vector, component of node deflection in plane |
| bm | Coefficient proportional to the mass matrix in the Rayleigh damping model |
| bk | Coefficient proportional to the stiffness matrix in the Rayleigh damping model |
| brj | Damping at the support |
| b | Damping in the joint of the solid bar with 1 DOF |
| k | Stiffness in the joint of the solid bar with 1 DOF, as well as sequence step size, sequence step |
| con | Multiplication (proportional) constant |
| x, y, z | Axes of the coordinate system, or components of the position vector |
| u(m) | mth element of input variable vector u for a function in Simulink |
| MATLAB® | (MathWorks, 1 Apple Hill Drive, Natick, MA 01760 USA, Founded in 1984) |
References
- Ondocko, S.; Svetlik, J.; Jánoš, R.; Semjon, J.; Dovica, M. Calculation of Trusses System in MATLAB—Multibody. Appl. Sci. 2024, 14, 9547. [Google Scholar] [CrossRef]
- MathWorks, Inc. Simscape™ Multibody™ Getting Started Guide. The MathWorks. 2025. Available online: https://www.mathworks.com/help/pdf_doc/sm/sm_gs.pdf (accessed on 17 June 2025).
- MathWorks, Inc. Simscape™ Multibody™ User’s Guide. The MathWorks. 2025. Available online: https://www.mathworks.com/help/pdf_doc/sm/sm_ug.pdf (accessed on 17 June 2025).
- Langtangen, H.P.; Pedersen, G.P. Scaling of Differential Equations; Springer Nature: Berlin/Heidelberg, Germany, 2016. [Google Scholar]
- Bradley, D. What is mechatronics and why teach it? Int. J. Electr. Eng. Educ. 2004, 41, 275–291. [Google Scholar] [CrossRef]
- Bishop, R.H. Mechatronics: An Introduction; CRC Press: Boca Raton, FL, USA, 2017. [Google Scholar]
- MathWorks, Inc. SimMechanics™ 3 User’s Guide; The MathWorks: Natick, MA, USA, 2009. [Google Scholar]
- Hroncova, D.; Pastor, M. Mechanical system and SimMechanics simulation. Am. J. Mech. Eng. 2013, 1, 251–255. [Google Scholar]
- Frankovský, P.; Hroncová, D.; Delyová, I.; Virgala, I. Modeling of dynamic systems in simulation environment MATLAB/Simulink–SimMechanics. Am. J. Mech. Eng. 2013, 1, 282–288. [Google Scholar]
- MathWorks, Inc. System Scaling by Nominal Values. 2025. Available online: https://www.mathworks.com/help/releases/R2025b/simscape/ug/system-scaling-by-nominal-values.html?searchHighlight=command+scaling&s_tid=doc_srchtitle#mw_3cc30ae6-fec4-4118-a0d3-032dbf0901cc (accessed on 3 October 2025).
- Miller, S.; Soares, T.; Weddingen, Y.V.; Wendlandt, J. Modeling flexible bodies with simscape multibody software. In An Overview of Two Methods for Capturing the Effects of Small Elastic Deformations; MathWorks: Natick, MA, USA, 2017. [Google Scholar]
- Bauchau, O.A.; Craig, J.I. Euler–Bernoulli beam theory. In Structural Analysis; Springer: Dordrecht, The Netherlands, 2009; pp. 173–221. [Google Scholar]
- Trebuňa, F.; Šimčák, F. Odolnosť Prvkov Mechanických Sústav; Technická Univerzita: Košice, Slovakia, 2004. [Google Scholar]
- Lengvarský, P.; Pástor, M.; Bocko, J. Riveted Joints and Linear Buckling in the Steel Load–bearing Structure. Am. J. Mech. Eng. 2017, 5, 329–333. [Google Scholar]
- Karnovsky, I.A.; Lebed, O. Advanced Methods of Structural Analysis; Springer Nature: Berlin/Heidelberg, Germany, 2021. [Google Scholar]
- Plevris, V.; Ahmad, A. Deriving analytical solutions using symbolic matrix structural analysis for continuous beams. Sci. Rep. 2025, 15, 1–16. [Google Scholar] [CrossRef] [PubMed]
- Florian, Z.; Pellant, K.; Suchánek, M. Technická mechanika I–Statika; Vysoké Učení Technické v Brně: Brno, Czech Republic, 2004. [Google Scholar]
- Available online: https://github.com/stefanondocko/AddOptimInSimulink (accessed on 17 June 2025).
- MathWorks, Inc. Using Simulink. In Simulink–Model–Based and System–Based Design; MathWorks Inc.: Natick, MA, USA, 2002. [Google Scholar]
- MathWorks, Inc. Speed Up Simulation. 2023. Available online: https://www.mathworks.com/help//releases/R2021a/simulink/ug/speed-up-simulation.html (accessed on 22 June 2025).
- Gavin, H.P. Classical Damping, Non–Classical Damping and Complex Modes; Duke University: Durham, NC, USA, 2018. [Google Scholar]
- MathWorks, Inc. Choose an ODE Solver. Ordinary Differential Equations. 2025. Available online: https://uk.mathworks.com/help/matlab/math/choose-an-ode-solver.html (accessed on 17 June 2025).
- Oršanský, P.; Ftorek, B. Štatistické a Numerické Metódy; EDIS–ŽU: Žilina, Slovakia, 2017. [Google Scholar]
- Buša, J.; Pirč, V.; Schrotter, Š. Numerické Metódy, Pravdepodobnosť a Matematická Štatistika; FEI TU: Košice, Slovakia, 2006. [Google Scholar]
- Available online: https://github.com/vplevris/SymbolicMSA-2DTrusses (accessed on 17 June 2025).
- Murín, J.; Hrabovský, J.; Kutiš, V. Metóda Konečných Prvkov—Vybrané Kapitoly pre Mechatronikov; Slovenská technická univerzita v Bratislave: Bratislava, Slovakia, 2014. [Google Scholar]
- Öchsner, A. Euler–Bernoulli beam theory. In Classical Beam Theories of Structural Mechanics; Springer: Berlin/Heidelberg, Germany, 2021; pp. 7–66. [Google Scholar]
- MathWorks, Inc. Solver–Solver that Computes States and Outputs for Simulation. 2025. Available online: https://uk.mathworks.com/help/simulink/gui/solver.html (accessed on 17 June 2025).
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. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).