What are symbolic variables?
59 次查看(过去 30 天)
显示 更早的评论
I don't really understand what they are and why they're needed. I also couldn't find anything about this in the documentary.
回答(1 个)
Walter Roberson
2017-1-17
A symbolic variable can hold an expression instead of just a numeric value. For example it can hold the expression sin(x^2+1) . The symbolic toolbox can reason about the expressions, such as finding the solution to equations, or such as doing calculus. For example,
syms x
diff(sin(x^2+1),x)
comes out as 2*x*cos(x^2 + 1)
This can be used to create and manipulate formula instead of having to work with specific numeric values.
Symbolic variables are not restricted to integers or floating point numbers, so the toolbox can reason about irrational values with full theoretic precision. For example,
>> symsum(1/x^2,x,1,inf)
ans =
pi^2/6
1 个评论
Walter Roberson
2017-1-17
Also symbolic numbers can have a higher precision than hardware numbers so you can compute to more decimal places. The trade off is that symbolic computations need more memory and are slower than hardware computation
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!