필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Ekaterina Wiktorski
Ekaterina Wiktorski 2016년 4월 12일
편집: Walter Roberson 2016년 4월 12일
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?

답변 (1개)

Steven Lord
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.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by