| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → SimMechanics |
| Contents | Index |
| Learn more about SimMechanics |
| On this page… |
|---|
About Trimming and Inverse Dynamics Ways to Find an Operating Point Trimming in the Kinematics Mode |
Note This study requires Control System Toolbox at an optional step, Finding the Minimal Realization of the Linearized Model. |
This case study finds a Stewart platform steady state with the SimMechanics Kinematics mode . You specify motions and determine the forces and torques to produce those motions (the inverse dynamics problem). If you are not familiar with implementing inverse dynamics in the SimMechanics environment, work through the Finding Forces from Motions section of the Analyzing Motion chapter before attempting this case study.
Use the Inverse Dynamics and Kinematics modes for inverse-dynamic analysis of open- and closed-topology systems, respectively. The Stewart platform has a closed topology and thus requires the Kinematics mode. Once you have an operating point, you can linearize the motion.
Trimming a system means locating a configuration of its states with certain prior conditions imposed on the states and possibly their derivatives. In a mechanical context, it means imposing conditions on certain positions and velocities, then determining the remaining positions and velocities such that the entire state of the machine is consistent. A by-product of mechanical trimming is determination of the forces/torques necessary to produce the specified motion. These motion states constitute a trim or operating point. Trimming problems can have one solution, more than one, or none.
Pure inverse dynamics imposes prior motions on all degrees of freedom. Then all the states are determined. (The consistency of the motions is not guaranteed, but must be checked.) Only the forces/torques remain to be found.
To find an operating point or steady state for a SimMechanics model,
Use the trim command in Simulink. See Trimming Mechanical Models in the Analyzing Motion chapter.
Use the more powerful techniques provided by Control System Toolbox and Simulink Control Design. See the About Controllers and Plants case study in this chapter.
Use the SimMechanics inverse dynamics modes. You can manipulate the mechanical states of your model directly with motion actuation rather than manipulate them through Simulink.
Here are the files needed for this case study. The models also call the initialization M-files. Open the first model by clicking the first link.
| File | Purpose |
|---|---|
| mech_stewart_control_equil | Kinematics model for determining Stewart platform force equilibrium |
| mech_stewart_control_equil_leg | Library model of Stewart platform leg for kinematic analysis |
| mech_stewart_control_plant | Forward dynamics model for linearizing the Stewart platform |
| mech_stewartplatform_leg | Library model of Stewart platform leg for forward dynamic analysis |

The mech_stewart_control_equil model has some preset nondefault settings.
Configuration Parameters
| Setting | Value |
|---|---|
| Solver > Simulation time > Stop time | 0.005 seconds |
| Data Import/Export > Save to workspace | Time and States selected
> tout and xout |
| SimMechanics > Diagnostics | Mark automatically cut joints selected |
| SimMechanics > Visualization | Display machines after updating diagram and Show animation during simulation selected |
Machine Environment
| Setting | Value |
|---|---|
| Parameters > Analysis mode | Kinematics |
| Parameters > Machine Dimensionality | 3D Only |
| Constraints > Constraint solver type | Machine Precision |
| Constraints > Use robust singularity handling | Selected |
The six Stewart platform legs are instances of a basic leg saved in the mech_stewart_control_equil_leg library. It takes as inputs the motion actuation signals that specify position and velocity as a function of time. The position signals specify the platform's motion relative to the initial geometric configuration.

In mech_stewart_control_equil, the Motion subsystem specifies motion as trivial: zeroes for all six leg positions and velocities. That is, the model holds the platform still in its initial state.
Each Stewart platform leg outputs the computed leg force needed to maintain the motion specified by the motion actuation. These six measured forces are directed to your MATLAB workspace by the To Workspace block.
The output forces are stored in the vector variable Forces. The block retains the force vector only from the last time step.
Now run mech_stewart_control_equil.
In your workspace, locate tout and xout. These are the time steps and the corresponding state values, respectively.
In the Inverse Dynamics mode, there are 40 mechanical states counted by Simulink, associated with the mechanical constraints. Consult Identifying the Simulink and Mechanical States of the Stewart Platform earlier in this chapter.
Locate Forces in the workspace. These are the six force values along each leg to hold the platform still against falling by gravity. The values are positive (expansive) along the legs.
Knowing the steady-state forces needed to keep the platform still, you now linearize another version of the model, mech_stewart_control_plant. It has settings similar to mech_stewart_control_equil, except that:
The Analysis mode is set to Forward Dynamics.
The simulation time is 10 seconds.
Time and Output, tout and yout, respectively, are saved to workspace.
Open the mech_stewart_control_plant model.

The six legs are instances of the mech_stewartplatform_leg library. This leg takes force as an input and outputs position and velocity, as appropriate for forward dynamics.
The standard model input variable is u. The force vector signal is a model input.
The position and velocity vector signals are model outputs. The Data Import/Export output variable is yout and will appear in your workspace assigned with data after you simulate.
Close the model.

You can simulate the mech_stewart_control_plant model without opening it.
nomForces = Forces'; % Transpose the force vector
Linearize the model by entering
[A,B,C,D] = ...
linmod('mech_stewart_control_plant',[],nomForces);The arguments are, in order,
Model name
Model state vector (not used)
Model input vector u = nomForces
These (unreduced) output matrices are the standard state-space representation of a linearized model. The space is defined by x, u, and y, the state, input, and output vectors, respectively.
![]()
There are 52 states, 6 inputs, and 12 outputs. Thus A, B, C, D have dimensions 52-by-52, 52-by-6, 12-by-52, and 12-by-6, respectively. Not all these matrix entries are independent.
Note This step requires Control System Toolbox. |
Of the 52 mechanical states, the Stewart platform has only 12 independent states, corresponding to six degrees of freedom (DoFs). Each DoF corresponds to one position and one velocity.
To eliminate the redundant states, enter
[a,b,c,d] = ... minreal(A,B,C,D); 40 states removed.
at the command line. The a, b, c, d matrices are reduced in size to 12-by-12, 12-by-6, 12-by-12, 12-by-6, respectively.
See Open-Topology Linearization: Double Pendulum in the Analyzing Motion chapter and the Simulink documentation.
Trimming in the Kinematics Mode and Linearizing the Stewart Platform at an Operating Point preceding present the simplest possible trimming scenario:
All six degrees of freedom (DoFs) are determined by prior specification of positions and velocities. These are the inputs to the problem. The outputs are the forces necessary to maintain the specified motion. The simulation solves a pure inverse dynamics problem.
The actual motion actuation signals require the platform to hold still relative to its initial geometric configuration.
In a more typical trimming problem, you specify some of the DoFs by motion actuation and leave the others free to respond to forces/torques. Such a scenario is a mixed dynamics problem. In the SimMechanics environment, you can solve such problems in
Forward Dynamics mode, where the tree states (DoFs corresponding to uncut Joints) are the mechanical states
Kinematics mode (closed topology), where the cutting constraints that replace the cut Joints constitute the mechanical states
Inverse Dynamics (open topology), where there are no mechanical states
Complementarity of Inverse and Forward Dynamics
| Actuate DoF with... | Sense on DoF... |
|---|---|
| Forces/torques | Motions |
| Motions | Forces/torques |
If you want to solve such a problem for the Stewart platform, you need to
Use a library leg with
Force input
Motion output
for each leg simulated in forward dynamics. You actuate it with a force and measure its motion. Use the mech_stewartplatform_leg block library.
Use a library leg with
Motion input
Force output
for each leg simulated in inverse dynamics. You actuate it with a motion and measure the corresponding force. Use the mech_stewart_control_equil_leg block library.
The steady-state outputs are in turn the inputs for linearization.
Complementarity of Trimming and Linearization
| Trimming Output Becomes... | ...Linearization Input |
|---|---|
| Measured motions become... | ...Motion actuation signals |
| Measured forces/torques become... | ...Force/torque actuation signals |
To carry out a linearization of your system,
Create a variant model in Forward Dynamics mode that takes
The steady-state forces as linearization input force actuation
The steady-state motions as linearization input motion actuation
Linearize with linmod.
linmod('forward_dynamics_model_to_linearize', state, input)This command can feed model inputs into the linearized simulation as a command argument. See the command reference for more details.
![]() | Modeling the Stewart Platform | About Controllers and Plants | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |