by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - SimMechanics
Introduced first in SolidGeometry 3.0, Creation date: 2016-11-13, Last change: 2025-09-14
See Also: smbSetTransformationMatrix
, smbSetTranslationVector
, smbCreateSG
smbSetRotationMatrix(BName,R)
BName: | Block Name or gcb | |
R: | 3x3 Rotation Matrix |
This function, smbSetRotationMatrix, is designed to set the rotation matrix for a specified block in a SimMechanics model. Below is a detailed explanation of the algorithm and its parameters:
R into a string format suitable for use in Simulink's set_param function. This is done using the sprintf function, which formats the matrix into a string with the elements arranged in a specific order. The matrix is transposed before formatting to ensure the correct orientation.set_param function to set the rotation method of the specified block (BName) to 'RotationMatrix'. This tells Simulink that the block's rotation should be defined by a matrix rather than other methods like Euler angles or quaternions.set_param again. The formatted string R is passed as the value for the 'RotationMatrix' parameter of the block.In summary, this function configures a block in a SimMechanics model to use a specified 3x3 rotation matrix for its orientation. It involves formatting the matrix into a string and setting the appropriate parameters on the block using Simulink's set_param function.