smbSetRotationMatrix

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

Sets a Block Rotation Matrix



See Also: smbSetTransformationMatrix , smbSetTranslationVector , smbCreateSG

Example Illustration

 missing image of smbSetRotationMatrix (BName,R)

Syntax

smbSetRotationMatrix(BName,R)

Input Parameter

BName: Block Name or gcb
R: 3x3 Rotation Matrix




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, 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:

Input Parameters

Algorithm Steps

  1. The function begins by converting the input rotation matrix 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.
  2. Next, the function uses the 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.
  3. Finally, the function sets the actual rotation matrix for the block using 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.

Algorithm explaination created using ChatGPT on 2025-08-18 21:48. (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