syms

syms var1 . varN creates symbolic scalar variables var1 . varN of type sym . Separate the different variables with spaces. This syntax clears all previous definitions of var1 . varN .

syms var1 . varN [n1 . nM] creates arrays of symbolic scalar variables var1 . varN , where each array has the size n1 -by- . -by- nM and contains automatically generated symbolic scalar variables as its elements. For example, syms a [1 3] creates the symbolic array a = [a1 a2 a3] and the symbolic scalar variables a1 , a2 , and a3 in the MATLAB ® workspace. For multidimensional arrays, these elements have the prefix a followed by the element’s index using _ as a delimiter, such as a1_3_2 .

syms var1 . varN n creates n -by- n matrices of symbolic scalar variables filled with automatically generated elements.

syms ___ set sets the assumption that the created symbolic scalar variables belong to set , and clears other assumptions. Here, set can be real , positive , integer , or rational . You can also combine multiple assumptions using spaces. For example, syms x positive rational creates a symbolic scalar variable x with a positive rational value. Use this option in addition to any of the input argument combinations in previous syntaxes.

Symbolic Scalar Functions

syms f(var1. varN) creates the symbolic function f of type symfun and the symbolic scalar variables var1. varN of type sym , which represent the input arguments of f . This syntax clears all previous definitions of var1. varN including symbolic assumptions. The evaluated symbolic function f(var1. varN) is of type sym .

syms f(var1. varN) [n1 . nM] creates an n1 -by- . -by- nM symbolic array with automatically generated symbolic functions as its elements. This syntax also generates the symbolic scalar variables var1. varN that represent the input arguments of f . For example, syms f(x) [1 2] creates the symbolic array f(x) = [f1(x) f2(x)] , the symbolic functions f1 and f2 , and the symbolic scalar variable x in the MATLAB workspace. For multidimensional arrays, these elements have the prefix f followed by the element’s index using _ as a delimiter, such as f1_3_2 .

syms f(var1. varN) n creates an n -by- n matrix of symbolic functions filled with automatically generated elements.

Symbolic Matrix Variables

syms var1 . varN [nrow ncol] matrix creates symbolic matrix variables var1 . varN of type symmatrix , where each symbolic matrix variable has the size nrow -by- ncol . (since R2021a)

syms var1 . varN n matrix creates n -by- n symbolic matrix variables. (since R2021a)

Symbolic Matrix Functions

syms f(var1. varN) [nrow ncol] matrix creates the symbolic matrix function f of type symfunmatrix and the symbolic scalar variables var1. varN of type sym . The evaluated symbolic matrix function f(var1. varN) is of type symmatrix and has the size nrow -by- ncol . This syntax clears all previous definitions of var1. varN including symbolic assumptions. (since R2022a)

syms f(var1. varN) [nrow ncol] matrix keepargs keeps existing definitions of var1. varN in the workspace. If any of the variables var1. varN does not exist in the workspace, then this syntax creates them as symbolic scalar variables of type sym . The size of the evaluated symbolic matrix function f(var1. varN) is nrow -by- ncol . (since R2022a)

syms f(var1. varN) n matrix creates a square symbolic matrix function, where the evaluated symbolic matrix function f(var1. varN) has the size n -by- n . This syntax clears all previous definitions of var1. varN including symbolic assumptions. (since R2022a)

syms f(var1. varN) n matrix keepargs keeps existing definitions of var1. varN in the workspace. If any of the variables var1. varN does not exist in the workspace, then this syntax creates them as symbolic scalar variables of type sym . (since R2022a)

Array of Symbolic Objects

syms( symArray ) creates the symbolic scalar variables and functions contained in symArray , where symArray is either a vector of symbolic scalar variables or a cell array of symbolic scalar variables and functions. This syntax clears all previous definitions of variables specified in symArray including symbolic assumptions. Use this syntax only when such an array is returned by another function, such as solve or symReadSSCVariables .

Names of Symbolic Objects

syms lists the names of all symbolic scalar variables, functions, matrix variables, matrix functions, and arrays in the MATLAB workspace.

S = syms returns a cell array of the names of all symbolic scalar variables, functions, matrix variables, matrix functions, and arrays.