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

3 次查看(过去 30 天)
%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
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