What are symbolic variables in MATLAB? How they are different from normally used variables?

7 vues (au cours des 30 derniers jours)
What are symbolic variables in MATLAB?Are they data type or class?
Following are Links of mathworks pages for MATLAB classes and MATLAB data types
But neither of the two above links mentions the term symbolic variable?
Some websources mention that symbolic variables are used in calculus etc
Normally/generally the variables used in MATLAB have data type scalar or double but why we can't use them in calculus?Why we have to first define variable as symbolic?

Réponses (2)

Steven Lord
Steven Lord le 23 Fév 2021
Symbolic variables are instances of a class provided as part of Symbolic Math Toolbox. That documentation for MATLAB does not list all the data types / objects provided in all our toolboxes; the documentation for the toolbox that contains an object would be the right place to find information about that object. Just Manuel has linked to a function that creates symbolic variables, but if you want information about the class itself look at the documentation for the sym (only one s) function by running the command doc sym.
Normally/generally the variables used in MATLAB have data type scalar or double but why we can't use them in calculus?Why we have to first define variable as symbolic?
Normal double precision variables in MATLAB have a value. If I were to define x and y like this:
x = 1:10;
y = 2*x + 3
y = 1×10
5 7 9 11 13 15 17 19 21 23
y is a vector of ten values, 5:2:23. It is not a function of x anymore, so you couldn't for example integrate with respect to x. [Well, technically you could use trapz to approximate the integral, but that integral wouldn't be a function of x.] If instead you defined a symbolic variable, you could integrate with respect to that symbolic variable and the result would be a function of that symbolic variable.
syms z
w = 2*z + 3
w = 
int(w, z)
ans = 

Just Manuel
Just Manuel le 23 Fév 2021
try the matlab help:
Cheers
Manuel

Tags

Produits


Version

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by