General Flexible Beam

Slender extrusion with elastic properties for deformation

  • Library:
  • Simscape / Multibody / Body Elements / Flexible Bodies / Beams


The General Flexible Beam block models a body—a slender extrusion of constant cross section—with elastic properties and therefore the ability to deform. The beam can bend, stretch, and twist, as dictated by its boundary and loading conditions.

Cantilever Beam Subjected to Bending and Torsion

The deformation can vary over time. Variable deformation is superposed on the motion of the body as a whole. In other words, the beam can deform as it translates and rotates in the world frame. The coupling between the two motions is captured, with deformations impacting the overall motion of the body and vice versa.

For an example of a flexible beam, at the MATLAB command prompt, enter smdoc_flexible_cantilever_channel. The example uses an asymmetrical cross section for the beam and simulates its various deformations under a point load, an applied moment, or both. The degree to which the beam bends and twists varies with the point of application of the force.

Deformation Models

Bending and axial deformation follow from classical (Euler-Bernoulli) beam theory. The bending can be about any axis in the cross-sectional plane (xy) of the beam. Cross-sectional slices are assumed to be rigid in plane, to stay planar during deformation, and to always be perpendicular to the (generally deformed) centerline of the beam. As the theory is linear, deformation is assumed to be small (relative to the size of the beam).

The figure shows the impact of the linear assumption on the accuracy of the block. (The beam in this example is cantilevered and subjected to a transverse point load. The tip, rather than follow its true (and naturally curved) path, deflects in a straight line. At small deformations (δ), the two practically overlap, but, at large angles, the difference between them becomes evident. That error (ε) is shown in gray.)

Torsion, on the other hand, derives from classical (Saint-Venant) torsion theory. Cross-sectional slices are then rigid in plane but free to warp out of plane. As with bending, the theory is linear and deformation is assumed to be small.

The theories require the beam to be slender, which is to say that its length must far exceed the width of its cross section. The length (in the longitudinal direction) is specified as a block parameter—Length. The cross section (in the transverse plane) is specified in the block parameter of the same name. If the beam is stubby (short and thick), the model will simulate, but, as a key assumption has not been satisfied, the simulation results may not accurately reflect reality.

Beam Discretization

How accurate the deformation calculation is depends on how it is discretized. By default, the beam comprises a single beam element. The bending displacement distributions throughout the element are obtained by cubic Hermite interpolation between its ends; the axial displacement and torsional rotation distributions, on the other hand, are obtained by linear interpolation. The distributions become increasingly accurate as the beam is split into elements.

Use the Number of Elements block parameter (under the Discretization node) to change the discretization of the beam. Experiment with this parameter to obtain a good compromise between simulation accuracy (which may require more beam elements) and simulation speed (fewer beam elements). Use the fewest elements needed to satisfy your accuracy requirements.

Material Properties

The block is parameterized in terms of mass and stiffness parameters. These are as defined in textbooks on the mechanics of materials, with values being available from engineering databases. Here, the material is assumed to be homogeneous and isotropic (with the same properties everywhere and in every direction) as well as linearly elastic.

Damping is assumed to be linear. The damping matrix of the beam is proportional to the stiffness matrix of the same, with a constant of proportionality equal to the Damping Constant block parameter. Set this parameter to better capture, for example, the decay in oscillation amplitude that occurs in underdamped beams.

Note that damping can have a significant impact on simulation speed. Experiment with the value of the damping constant to balance the need for simulation accuracy with the need for simulation speed.

Beam Geometry

The beam cross section is specified as a MATLAB matrix of [x, y] coordinates. Each matrix row corresponds to a point, the collection of which connects, in the order given, to form a polyline. The material region is to the left of the polyline (as observed from one point to the next), with empty space being to its right. To ensure that the cross section is closed, the end points of the polyline are automatically connected to each other.

The cross section can take many shapes, including asymmetrical ones, like those in tee, channel, and angle beams. Cross sections with holes, however, are not supported. The techniques for modeling holes in the Solid block should not be used in this block. Such techniques require a cut through the material, leaving the beam cross section technically open. The beam will then behave in ways uncharacteristic for a closed cross-section with a true hole.

The extrusion itself is formed by sweeping the cross section along the local z-axis. The sweep is symmetric with respect to the xy-plane: one end is at half the beam length in the positive z direction, and the other at the same distance in the negative direction. The cross section is constant in both shape and size from one end to the other.

It is important that the polyline not intersect itself. Polylines with intersecting segments produce invalid cross sections and cause errors in the block. Note also that an excessive number of points can adversely affect the performance of the block, slowing down the calculation of the sectional properties and the rendering of the beam in Mechanics Explorer.

Connection Frames

At the ends of the extrusion are two frames (A and B) by which to connect the beam. The frames fall on the z-axis of the local reference frame, whose origin sets the [0,0] cross-section point. The reference frame, labeled R in the block visualization pane, serves merely as an internal reference for the beam, and it has no frame port by which to connect.

Beam Visualization

Issues of geometry and color—a beam too short, say, or a color specified wrong—are often easiest to catch by eye. Check the visualization pane regularly for unwanted changes, as these are easiest to troubleshoot (and the block parameters to revert) when they first occur. Click the button—at the far left in the visualization toolstrip—to update the visualization contents when a parameter changes.

Pan, rotate, roll, and zoom (in, out, or to a region) to better see a region of interest. Select a standard view, such as front, right, or top, to quickly align the camera with the axes of the reference frame. Look for these tools and views in the buttons of the visualization toolstrip. (Hover over a button for its name if unsure of what it does.)

Right-click the visualization pane to see more (context-sensitive) options. Use them to change background color, to set the up axis, or to split the visualization pane into tiles (for example, to see the beam from different views at once).

Click Apply or OK to commit any changes to the model. Note that closing the dialog box without clicking either button will cause all changes to be discarded.

Deformation under Gravity

The beam responds to gravity, but only that specified in the Mechanism Configuration block. The force due to a Gravitational Field block is ignored. If the frame network of which this block is a part contains a Gravitational Field block, the beam behaves as though in zero gravity. Using Flexible Beam and Gravitational Field blocks in the same frame network causes Diagnostic Viewer to issue a compilation warning.

Note that modeling gravity with both Mechanism Configuration and Gravitational Field blocks results in a (more severe) compilation error. The simulation can then no longer run until one source of gravity is eliminated—by setting gravity to None in the Mechanism Configuration block, for example, or by disconnecting every Gravitational Field block in the frame network.

Simulation Performance

Flexible beams can negatively impact the simulation speed of a model. The more of them there are, the slower the simulation becomes. For best performance, use the fewest flexible beams possible, avoiding them where deformation is negligible and rigid bodies suffice. Discretize each beam only as finely as you must, and experiment with the damping coefficient to better balance simulation accuracy with simulation speed.

Note that models with flexible beams tend to be numerically stiff. To avoid simulation issues, consider using a stiff solver such as ode15s or ode23t. Stiff solvers are denoted as such in the Configuration Parameters window. Using appropriate solver tolerances—both relative and absolute—can help to speed up simulation. Adjust these parameters if necessary to improve simulation performance.



expand all

Frame—one of two—by which to connect the beam in a model. In the undeformed configuration, this frame is at half the beam length in the -z direction relative to the origin of the local reference frame.

Frame—one of two—by which to connect the beam in a model. In the undeformed configuration, this frame is at half the beam length in the +z direction relative to the origin of the local reference frame.


expand all


Cross section of the beam, specified as an [x,y] coordinate matrix. Each row gives the [x,y] coordinates of a point on the cross-section outline. The points connect in the order given to form a closed polyline. To ensure that the polyline is closed, a line segment is always inserted between the last and first points specified.

The matrix rows must be arranged such that, from one point to the next, the interior of the cross section lies to the left and the exterior to the right. To ensure that the interior and exterior are always well defined, the polyline generated by the coordinate matrix must not intersect itself.

Total length of the beam. The beam is generated by extruding the specified cross section along the z-axis of the local reference frame. The extrusion is symmetric about the xy-plane, with half of the beam being extruded in the negative direction of the z-axis and half in the positive direction.

Stiffness and Inertia

Mass per unit volume of material—assumed here to be distributed uniformly throughout the beam. The default value corresponds to aluminum.

Elastic properties in terms of which to parameterize the beam. These properties are commonly available from materials databases.

Young's modulus of elasticity for the beam. This parameter is as defined in textbooks on the mechanics of materials (the ratio of axial stress to axial strain). The greater its value, the stronger the resistance to bending and axial deformation. The default value corresponds to aluminum.

Poisson's ratio for the beam. This parameter is as defined in textbooks on the mechanics of materials (the ratio of transverse to longitudinal strain). The value specified must be greater than or equal to 0 and smaller than 0.5. The default value corresponds to aluminum.

Shear modulus (or modulus of rigidity) of the beam. This parameter is as defined in textbooks on the mechanics of materials (the ratio of shear stress to engineering shear strain). The greater its value, the stronger the resistance to torsional deformation. The default value corresponds to aluminum.

Proportionality constant for damping internal to the beam. The larger this parameter, the faster the decay in beam vibrations when they occur. The product of the damping constant and the stiffness matrix of the beam gives the damping matrix used in the block calculations. This parameter can significantly impact simulation performance. Experiment with its value to balance simulation speed with simulation accuracy.

Calculated values of the mass and stiffness sectional properties of the beam. Click Update to see those values—and again if a parameter changes, to refresh those values.

The properties given include Centroid and Shear Center. The centroid is the point at which an axial force extends (or contracts) the beam without bending. The shear center is that through which a transverse force must pass to bend the beam without twisting.

The stiffness sectional properties are computed as follows:

  • Axial Rigidity: EA

  • Flexural Rigidity: [EIx, EIy]

  • Cross Flexural Rigidity: EIxy

  • Torsional Rigidity: GJ

The mass sectional properties are computed as follows:

  • Mass per Unit Length: ρA

  • Mass Moment of Inertia Density: [ρIx, ρIy]

  • Mass Product of Inertia Density: ρIxy

  • Polar Mass Moment of Inertia Density: ρIp

The equation parameters include:

  • A — Cross-sectional area

  • ρ — Density

  • E — Young's modulus

  • G — Shear modulus

  • J — Torsional constant (obtained from the solution of Saint-Venant's warping partial differential equation)

The remaining parameters are the relevant moments of area of the beam. These are calculated about the axes of a centroidal frame—one aligned with the local reference frame but located with its origin at the centroid. The moments of area are:

  • Ix, Iy — Centroidal second moments of area:


  • Ixy — Centroidal product moment of area:


  • Ip — Centroidal polar moment of area:



Number of elements into which to divide the beam. The more elements there are, the more accurate the computed deflections may be, albeit at the cost of simulation speed.


Choice of graphic to use in the visualization of the beam. The graphic is by default the geometry specified for the beam. Change this parameter to None to eliminate this beam altogether from the model visualization.

Parameterization for specifying visual properties. Select Simple to specify color and opacity. Select Advanced to add specular highlights, ambient shadows, and self-illumination effects.

RGB color vector with red (R), green (G), and blue (B) color amounts specified on a 0–1 scale. A color picker provides an alternative interactive means of specifying a color. If you change the Visual Properties setting to Advanced, the color specified in this parameter becomes the Diffuse Color vector.

Graphic opacity specified on a scale of 0–1. An opacity of 0 corresponds to a completely transparent graphic and an opacity of 1 to a completely opaque graphic.

True color under direct white light specified as an [R,G,B] or [R,G,B,A] vector on a 0–1 scale. An optional fourth element specifies the color opacity also on a scale of 0–1. Omitting the opacity element is equivalent to specifying a value of 1.

Color of specular highlights specified as an [R,G,B] or [R,G,B,A] vector on a 0–1 scale. The optional fourth element specifies the color opacity. Omitting the opacity element is equivalent to specifying a value of 1.

Color of shadow areas in diffuse ambient light, specified as an [R,G,B] or [R,G,B,A] vector on a 0–1 scale. The optional fourth element specifies the color opacity. Omitting the opacity element is equivalent to specifying a value of 1.

Surface color due to self illumination, specified as an [R,G,B] or [R,G,B,A] vector on a 0–1 scale. The optional fourth element specifies the color opacity. Omitting the opacity element is equivalent to specifying a value of 1.

Sharpness of specular light reflections, specified as a scalar number on a 0–128 scale. Increase the shininess value for smaller but sharper highlights. Decrease the value for larger but smoother highlights.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2018b