Why do I get a numerical value when I use syms?

1 view (last 30 days)
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?

Answers (1)

Steven Lord
Steven Lord on 12 Apr 2016
Edited: Steven Lord on 12 Apr 2016
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.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!