how can i fix Error using sym/min (line 101)

조회 수: 1 (최근 30일)
metasebia dabi
metasebia dabi 2021년 8월 13일
편집: Walter Roberson 2021년 8월 13일
%the effective depth for shear
de=((Aps.*fps.*dp)+(As.*fy.*ds))/((Aps.*fps)+(As.*fy));
dva=[(de-0.5*a) (0.9*de) (0.72*D)];
dv=min(dva);
Error using sym/min (line 101)
Input arguments must be convertible to floating-point numbers.

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 13일
편집: Walter Roberson 2021년 8월 13일
I notice that you have marked R2018a -- thanks for marking that in, as it is important information for this purpose.
In your release, symbolic min() could only process expressions that could be converted to numeric form. min() effectively used double() on each expression, and if double() failed then it was an error.
Expressions that used unbound symbolic variables would almost always fail to be converted to double.
Expressions that used bound symbolic variables such as int(cos(x)^2 - atan(x),x,0,5*pi) could often be converted to double and so could often be processed -- but int() and vpaintegral() cannot always converge, so the implicit double() can fail.
As of R2021a, MATLAB added in support for min() and max() of symbolic expressions -- MATLAB generates a symbolic placeholder that can be evaluated later when specific values are substituted for the variables.
Before R2021a, you needed to rewrite min() and max() in terms of piecewise, such as
Min = @(a,b) piecewise(a<=b, a, b)
dv = Min(Min((de-0.5*a),(0.9*de)), (0.72*D))
You indicate that dva is a symbolic function . You cannot index into a formula for a symbolic function in order to gain access to the parts of the function, so you will need to get at the parts before you create the symbolic function. Or you will have to call the function with symbolic parameters in order to get it to evaluate to a vector that you would then index to process.

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 8월 13일
It looks like one of your intoduced symbolic variables is defined to be class type of "char". Check all symbolic variables using whos to determine their class type.
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 8월 13일
No, that would not lead to this circumstance. In R2018a time frame, you could get the error using
syms x y
min([x,y])

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by