Sym: The second argument must be a vector of symbolic variables
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marcelin Dierickx
am 28 Dez. 2018
Kommentiert: Marcelin Dierickx
am 29 Dez. 2018
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.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Dez. 2018
You cannot use symbolic variables in the bounds.
You can add constraints as expressions to be solved for.
Weitere Antworten (1)
madhan ravi
am 28 Dez. 2018
Bearbeitet: madhan ravi
am 28 Dez. 2018
doc vpasolve % read the right usage of it
[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]); % only this the others after f]... I don't know why you have added
3 Kommentare
madhan ravi
am 29 Dez. 2018
Bearbeitet: madhan ravi
am 29 Dez. 2018
well you are right buddy but then it’s mentioned no where that the init_guess should be symbolic I can see in two places p/(...) and m/q are symbolic variables which is leading to error.
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!