Syntax
[T,time]=smbTofSimOut(simOut,Name)
Input Parameter
simOut : | | Simulation Result |
Name : | | Name of Frame |
Output Parameter
T : | | Transformation matrix [4 x 4 x n] |
time : | | time list [nx1] |
Examples
Try a simulation
VLFL_EXP20;
smbAddFrameSensor('LINK4.RF');
simOut=smbSimulate(1);
[T,t]=smbTofSimOut(simOut,'LINK4.RF');
whos T
Copyright 2016-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, smbTofSimOut
, is designed to extract transformation matrices and time data from a simulation output in SimMechanics. It is part of the SG-Library and was created by Tim Lueth.
Input Parameters
- simOut: This is the simulation result object from which data is extracted.
- Name: The name of the frame for which the transformation matrix and time data are required.
Output Results
- T: A 4x4xN transformation matrix, where N is the number of time steps.
- time: A list of time values corresponding to the transformation matrices.
Algorithm Steps
- Store the original frame name in
oName
.
- Retrieve the simulation output structure
sout
from simOut
.
- Use
smbWhich
to process the frame name and find the last part after the dot, storing it in FN
.
- Attempt to extract the time data using the signal name pattern
[Name '_T.' FN 'R']
. If the signal does not exist, an error is thrown.
- Retrieve the rotation matrix data
R
and translation vector data t
from the simulation output.
- Determine the number of time steps
n
from the size of t
.
- Initialize a zero matrix
T
of size 4x4xN.
- Assign the rotation matrix
R
to the top-left 3x3 part of T
.
- Assign the translation vector
t
(converted to mm) to the fourth column of the top 3 rows of T
.
- Set the bottom-right element of
T
to 1 for each time step.
This function assumes that the necessary signals have been created using smbAddFrameSensor
and that the simulation has been run using smbSimulate
.
Algorithm explaination created using ChatGPT on 2025-08-19 07:18. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21