Monday, July 6, 2020

Octave - Create two Symbolic matrices and calculte thier product

The script declare symbolic variables: psi phi theta psidot phidot thetadot, and create 3 matrices RzPsi, RyTheta, RzPhiwith with the variables and print the matrices.
The script also calculate symbolic products of the matrices RzPhi * RyTheta,
and print the product. 

% script demonstrate how to use Symbolic matice

% load symbolic package, and initilize PYTHON variable. (Octave only).
pkg load symbolic
setenv PYTHON C:\ProgramData\Anaconda3\pythonw.exe

% Declare Symbolic variable
syms psi phi theta psidot phidot thetadot

% Define Symbolic matrices
RzPsi = [[cos(psi), -sin(psi), 0]; [sin(psi), cos(psi), 0]; [0,0,1]]
RyTheta = [[cos(theta), 0, sin(theta)];[0,1,0];[-sin(theta), 0, cos(theta)]]
RzPhi = [[cos(phi), -sin(phi), 0]; [sin(phi), cos(phi), 0]; [0,0,1]]

disp(' Calculate the symbolic products of: RzPhi * RyTheta')

% Multiply Symbolic Matrices
RzPhi * RyTheta


The script output:


No comments:

Post a Comment

Featured Post

Solve simple Absolute Value Inequality

  Exam - BARTON COLLEGE PRACTICE PLACEMENT TEST Ex. 39 Exercise: The inequality |8 - x| < 8   is equivalent to:   a) x < 0 b) x &g...