CYBERTRONICS

Advanced Cybernetics Solutions

sym2code knowledge base

Sym2Code Example

Creating Symbolic Variables

Scalar variable

x \in \mathbb{R}
% Create a symbolic scalar variable with comment
SymScalar('x','My Scalar')

Vector variable

x = \begin{pmatrix} x_a, & x_b, & x_c \end{pmatrix}, \quad y=\begin{pmatrix} y_1 \\ y_2 \\  y_3 \end{pmatrix} \in \mathbb{R}^3
% Create a symbolic row vector variable with comment
SymVectorRow('x',{'a','b','c'},'Row Vector')
% Create a symbolic column vector variable with comment
SymVectorCol('y',1:3,'Col Vector')

Matrix variable

M = \begin{pmatrix} m_{1a} & m_{1b} & m_{1c} \\ m_{2a} & m_{2b} & m_{2c} \end{pmatrix} \in \mathbb{R}^{2\times 3}
% Create a symbolic matrix variable with comment
SymMatrix('m',1:2,{'a','b','c'},'Matrix')

Symmetric Matrix variable

S = \begin{pmatrix} s_{xx} & s_{xy} & s_{xz} \\ s_{xy} & s_{yy} & s_{yz} \\ s_{xz} & s_{yz} & s_{zz} \\ \end{pmatrix} = S^\top \in \mathbb{R}^{3\times 3}
% Create a symbolic symmetric matrix variable with comment
SymMatrixSymmetric('s',{'x','y','z'},'Symmetric')

Get in Touch

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close