Scalar Symbolic Variable
To create a symbolic scalar variable, the syms keyword can be used.
Syntax:
syms <variable list>
Example 1:
Matlab
% MATLAB Code syms x z; disp(x) disp(z) |
Every variable created will have a symbolic value, the same as its name.
Output:
MATLAB syms
Symbolic variables in MATLAB are variables that store a literal, such as x, $, as a symbol. This means that whatever a symbolic variable stores are not a value the computer can compute until it is assigned a numeric value. It is just a symbolic representation. To understand the same, see the following case.
If a user needs to display an equation like follows:
x = x + 1
This can be done with the usage of symbolic variables. One would make a symbolic variable, say x and assign them values x + 1. Then, typing the following will display the above equation.
x = x + 1
Now, we shall see how to create variables, functions, and matrix symbolic variables with an example of each.