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

1 visualización (últimos 30 días)
metasebia dabi
metasebia dabi el 13 de Ag. de 2021
Editada: Walter Roberson el 13 de Ag. de 2021
%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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 13 de Ag. de 2021
Editada: Walter Roberson el 13 de Ag. de 2021
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.

Más respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 13 de Ag. de 2021
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 comentario
Walter Roberson
Walter Roberson el 13 de Ag. de 2021
No, that would not lead to this circumstance. In R2018a time frame, you could get the error using
syms x y
min([x,y])

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by