how can i fix Error using sym/min (line 101)
조회 수: 1(최근 30일)
%the effective depth for shear
dva=[(de-0.5*a) (0.9*de) (0.72*D)];
Error using sym/min (line 101)
Input arguments must be convertible to floating-point numbers.
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.