Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Ekaterina Wiktorski
Ekaterina Wiktorski el 12 de Abr. de 2016
Editada: Walter Roberson el 12 de Abr. de 2016
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?

Respuestas (1)

Steven Lord
Steven Lord el 12 de Abr. de 2016
Editada: Steven Lord el 12 de Abr. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by