Why do I get a numerical value when I use syms?
1 次查看(过去 30 天)
显示 更早的评论
In a function body I have following expressions:
syms eps
Fi=1/(1+fi);
N_theta1=Fi/le*(6*eps-6*eps^2);
where le and fi were specified as inputs to the function.
Later I want to integrate a function, containing N_theta1 (which depends on eps, which is symbolic), with respect to eps. I get an error "Undefined function 'int' for input arguments of type 'double'." because N_theta1 has a numerical value! I cannot understand why. In the Workspace eps is defined as symbolic 1x1 value...Any idea?
0 个评论
回答(1 个)
Steven Lord
2016-4-12
编辑:Steven Lord
2016-4-12
You're "poofing" a variable named eps into the workspace at runtime, but when MATLAB parsed the file there was no sign that eps was going to be a variable so it "decided" eps was the eps function. To solve this, assign "eps = 0;" prior to your syms call, use eps = sym('eps'); instead of syms, or use a different variable name.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!