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

4 visualizzazioni (ultimi 30 giorni)
metasebia dabi il 13 Ago 2021
Modificato: Walter Roberson il 13 Ago 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.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
metasebia dabi il 13 Ago 2021
N.B dva is a syms fun

Accedi per commentare.

### Risposta accettata

Walter Roberson il 13 Ago 2021
Modificato: Walter Roberson il 13 Ago 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.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Più risposte (1)

Sulaymon Eshkabilov il 13 Ago 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 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 13 Ago 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])

Accedi per commentare.

### Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by