Guy on Simulink

Simulink & Model-Based Design

Flexible Bodies in SimMechanics 7

Posted by Guy Rouleau,

This week we see how to create flexible bodies in SimMechanics. For that, we will use techniques seen in previous posts like Building Models with MATLAB Code and Self-Modifying Subsystems.

Flexible Beam

The Lumped Parameter Approach

Using a lumped parameter approach, we can approximate a flexible body using a series of rigid bodies connected by springs and dampers. The material properties and the cross section of the flexible body determines the spring stiffness and damping coefficients.

Lumped Flexible Beam

The Fundamental Element

To begin, in SimMechanics, we create one element to be duplicated as many times as needed and store it in a library. For a beam bending about one axis, our fundamental element looks like:

One Element

Assembling the Beam

Now that we have one element, we can create a subsystem that will assemble as many elements as desired. Here is what the final result looks like:

Self-Modifying Flexible Beam

To implement this block, we follow the self-modifying subsystem workflow suggested by Seth in a previous post. In the Mask Initialization tab of the subsystem, we define a function that deletes the content of the subsystem and redraws it when needed.

Mask Initialization

To delete the content, we use delete_line and delete_block.

Deleting the beam

To redraw the subsystem, we use add_block and add_line.

Drawing the beam

The Result

Flexible bodies open a lot of possibilities. One of them is vibration analysis. With a beam composed of 25 elements, I have been able to observe the first three normal modes of the beam:

First mode
Mode 1

Second Mode
Mode 2

Third mode
Mode 3

Now it's your turn

Here are a few tips if you want to dig deeper in this area:

Try modeling flexible bodies in SimMechanics and let us know what you think by leaving a comment here.

7 CommentsOldest to Newest

Jerry S replied on : 1 of 7

I’m attempting to model a cable hanging between two points of different heights in SimMechanics (2nd generation), and this Flexible Beam example has been very helpful so far. In the simulation, the cable forms a catenary as expected. However, the physical system I’m attempting to model will also have a hanging mass sliding down that cable. I can’t figure out how to model the interaction between such a mass and the cable. Right now, I have the mass connected to a 6-DOF joint connected to the World Frame. The mass is initially positioned at the high side of the cable. After the simulation starts, gravity causes the mass to drop through the cable. Any ideas? Would it be easier to try this in First Generation SimMechanics?

Guy Rouleau replied on : 2 of 7

@ Jerry: Thanks for the comment, this is a very interesting application. This type of “point-on-flexible-curve” problem is very challenging. the current version of SimMechanics either first or second generation cannot directly simulate this system.

To make that happen, you will need to go through Simulink and compute the force relation between the cable and sliding mass, to finally apply the resulting force to the appropriate element of the cable.

Jerry S replied on : 3 of 7

I am working on a model similar to the one I described earlier, but without the sliding mass. I have a fixed mass in the middle of the cable. Before the simulation begins, SimMechanics determines the initial conditions of the joints throughout the simulated flexible cable. Then, as gravity takes effect, the cable oscillates. I would like the initial conditions to be such that there is no motion unless I apply an external force. Then, I would be able to apply a force to the mass and observe the reaction in the cable. Is there a way to execute an optimization function for the initial conditions for the cable/mass system, so that there is no motion (due to gravity) after the simulation begins?

Anton B. replied on : 4 of 7

@ Jerry :

Sorry to “renew” the old thread, but

I think, a good work-around could be the application of the gravity as a function of time over a short period, so that your computations do not last for too long. This approach is very popular in mechanical / geomechanical modelling, when one does not want to see numerical high frequencies , arising from the fact, that gravity is suddenly applied as a step at the initial phase of the numerical model.


Etienne replied on : 5 of 7

Hi Guy

Have you tried to build a flexible component with a state space block, similar to the paper and examples from the first generation? I have tried to do this with the second generation, but cannot get the beam example to work.



Bruno replied on : 6 of 7

Hi, thx for this example. I’m pretty new on SM and I find this really interesting.
I was looking at the code and I couldn’t find the parameter initialization for K,C,Lw and d.
Could you please lead me on the path?

thx a lot,


Pedram replied on : 7 of 7

Hi Guy,
Thanks for your example, it was really great and helped me a lot. I am modeling a flexible link in 2nd gen but I have problems with K and C parameters and I couldn’t find the right number of them, I searched the relation between Elasticity and stiffness ( K ) in web and I found these two ( E.I /L and E.A /L ) I tried them both and they didn’t answer. I wanna know how you define these numbers. ( K & C =????? )



Add A Comment

What is 7 + 10?

Preview: hide