MATLAB: Sym: The second argument must be a vector of symbolic variables

MATLABsymsymbolicSymbolic Math Toolboxvpasolve

This code:
R = 9 ; T = 300 ; g = 10 ;
syms h p Mm q m v b a f
F = (sqrt((h*(g*(q*(a+v)-m+((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)*(R*T*q/2*(1/p+1/(p+q*g*h))-Mm))-2*f))^2+4*(R*T*((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)*log(R*T*((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)/(p*((Mm*((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)+m)/q-v-a))))^2)-h*(g*(q*(a+v)-m+((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)*(R*T*q/2*(1/p+1/(p+q*g*h))-Mm))-2*f))/(2*R*T*((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)*log(R*T*((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)/(p*((Mm*((m-q*v)/(R*T/(p/q+g*h)-Mm)+b)+m)/q-v-a)))) ;
dF_h = diff(F,h);
dF_p = diff(F,p);
dF_Mm = diff(F,Mm);
dF_q = diff(F,q);
dF_m = diff(F,m);
dF_v = diff(F,v);
dF_b = diff(F,b);
dF_a = diff(F,a);
dF_f = diff(F,f);
[Sh,Sp,SMm,Sq,Sm,Sv,Sb,Sa,Sf] = vpasolve([dF_h==0,dF_p==0,dF_Mm==0,dF_q==0,dF_m==0,dF_v==0,dF_b==0,dF_a==0,dF_f==0],[h,p,Mm,q,m,v,b,a,f],[0 Inf;30000 Inf;2 300;p/(R*T/Mm-g*h) 10000;0 Inf;0 m/q;0 Inf;0 Inf;0 Inf],'Random',true);
Gives me error:
Error using
sym.getEqnsVars>checkVariables (line 92)
The second argument must be a
vector of symbolic variables.
Error in sym.getEqnsVars (line 54)
checkVariables(vars);
Error in sym/vpasolve (line 132)
[eqns,vars] =
sym.getEqnsVars(varargin{1:N});
Error in Rendement (line 17)
[Sh,Sp,SMm,Sq,Sm,Sv,Sb,Sa,Sf] = vpasolve([dF_h==0;dF_p==0;dF_Mm==0;dF_q==0;dF_m==0;dF_v==0;dF_b==0;dF_a==0;dF_f==0],[h;p;Mm;q;m;v;b;a;f],[0 Inf;30000 Inf;2 300;p/(R*T/Mm-g*h) 10000;0 Inf;0 m/q;0 Inf;0 Inf;0 Inf],'Random',true);
And I don't get why.
The equation is long, no real need to read them.
Thank you for answering.

Best Answer

You cannot use symbolic variables in the bounds.
You can add constraints as expressions to be solved for.
Related Question