File Exchange

image thumbnail

Simscape Flexible Beam Stress (BeamStressLib)

version 1.1.2 (277 KB) by Alberto Mora
Improved "General Flexible Beam" of Simscape, that compute von-Mises stress at beam ends for rectangular beams.


Updated 05 May 2021

View Version History

View License

The aim of this library is to expand Simscape beam library, providing all the information an engineer requires, in a straightforward way. You can get info of Von-Mises stress and strain, reaction forces at beam ends, relative and absolute displacements of the beams.

Simscape is a powerful tool embedded in Simulink environment that helps you to model physical systems. Simscape multubody give the possibility to model flexible beams using Euler theory. However, in engineering problems, it is very common to design and optimize structural elements, and for this reason it is important to keep under control the stress in the structure. Simscape library does not provide such important information (and moreover it is not easy to extract information like displacements or forces).

The aim of this library is to expand Simscape beam library, providing all the information an engineer requires, in a straightforward way.

This block relies on Simscape "General Flexible Beam" to represent static and dynamic behaviour of flexible beam, with a rectangular cross-section, estimating the stress (and other results) at its ends. The flexible element used is "General Flexible Beam" of Simscape library in order to be compatible also with Simscape releases before 2020a.
A routine helps you to visualize the stress data and better understanding the stress distribution in the cross section. You can turn on and off the visualization routine in the "Output Parameters" tab.
Stresses (and strain) are computed only on 9 points in the cross section (sketch in the notes). IMPORTANT: The plot adopts a linear interpolation between those points just to better visualize, with some approximation, the stress distribution.

Stresses are evaluated keeping into account both bending stress, normal stress, shear stress and torsional stress in 9 different points of the cross-section of the beam (at the four edges, four in the middle of each side and one in the center of the beam). Stresses are combined according to Von-Mises equivalent stress. The stress analysis, as well as the Simscape beam model (General Flexible Beam), assume the beam is “long”, in comparison to the cross-section, adopting Euler-theory where the bending effect is greater than shear effect (i.e. shear compliance is neglected). In other words, the length of the beam should be about x10 times the cross-section side. Only for short beams shear deflection is not negligible and therefore it is better to use Timoshenko-Ehrenfest beam theory (at the moment not implemented in Simscape).
This custom block allows you to input geometry, material of the beam, and when you connect the two ports of the beam to the rest of the world, it computes stress, strain displacement and applied loads on the beam ends.

Data refer to S.I. for both main units like (kg, m, s) and derived units (N, N*m, rad). [In the previous release Young modulus E and the stresses were measured in MPa (and not Pa), as in the usual engineering practice. However it wasn't a good idea to assume stress in [MPa] since the user can forget it, so it was decided to use S.I. also in stresses so in Pa].

Even if this library is optimized to reduce the computational time, large model can be even x6 times slower than using simple "Flexible Beam" elements (without stress and force informations).

The results of this library was checked with a professional FEM software (Nastran), with a 1D beam model, in many loading conditions, showing a good agreement between this library and the FEM model.

If you have suggesion, please let me know in the comments: I will update it!

Thanks to the CNR-STIIMA Institute (DASM research group) for their support during the development of this library.

Cite As

Alberto Mora (2021). Simscape Flexible Beam Stress (BeamStressLib) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Pierre-Eric Lys

Great, Thanks a lot Alberto

Alberto Mora

For modify the parameters of the size (and all the others parameters) of the beam, you just need to modify the variable inside the mask of the beam element (double click on the beam element, and will pop-up the menu where you can set all beam parameters).

Anyhow, you can also directly modify the size of the beam by modifying the value in the "Example_script.m". Now the size is b = 0.003; h = 0.001; L1 = 0.015; but you can adjust as you want.

Alberto Mora

Hi Pierre, I slightly modifyed the example in order to be more clear ("t" now is called "h")..
- b is the Width of the cross section of the beam.
- h is the height of the cross section of the beam.
- L1 is the length of the beam.
I am happy that this library can be helpful for someone! If you have further suggestion, please let me know.

Pierre-Eric Lys

Great, I have tried and it's working well. Congratulation for this impressive work. I have one more question. Can you describe the t and L1 parameters in the example_script.m
Can you also indicate how to set the value of h and L to desired dimensions.

Thanks in advance

Alberto Mora

Thank you Pierre for highlight that. It was a forgetfulness. The stesses was plotted starting from 99.9 seconds, but the simulation finish only after 2 seconds. Now I parametrized it in order to avoid it.
Best regards,

Pierre-Eric Lys


I have downloaded the files both on mac and pc, both are configured with Matlab 2021a. The simulation runs properly and I get the results on the scopes but the plot stress routine doesn't seem to work. Therefore the colored stress body doesn't appear. Any recommendation ?

Thanks in advance

Liam Moxey

Ivan Gasparini


MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!