Why 'solve' function does not work with me
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Esraa Abdelkhaleq
le 17 Mai 2016
Modifié(e) : Walter Roberson
le 18 Mai 2016
I want to solve this Eqn for qpl(s):
L(s) = qpl(0) - Kel*qpl(s) - s*qpl(s) + (Nh0*Rh*fplh)/s - (Nc0*Rc*fplc)/(Kgr - s)
When I tried to solve it using "solve" function, an error appeared and I do not understand what is the mistake. I know that if I want to solve such equation I should type:
S = solve(eqn, var)
So I wrote:
syms Kel Nh0 Rh fplh Nc0 Rc fplc Kgr real
syms qpl(s) s
L(s) = qpl(0) - Kel*qpl(s) - s*qpl(s) + (Nh0*Rh*fplh)/s - (Nc0*Rc*fplc)/(Kgr - s);
S = solve (L(s),qpl(s))
But error appeared. Any help?
2 commentaires
FannoFlow
le 17 Mai 2016
Was the error that it couldn't find an explicit solution? If so, thats because when it tried so solve, it simply couldn't find any way to solve for qpl(s).
Speaking of which, I'm not sure what you are trying to do with your notation, but if you are writing L(s) meaning that L is a function of s, try doing this instead:
syms Kel Nh0 Rh fplh Nc0 Rc fplc Kgr real
syms qpl_s s
L_s = qpl(0) - Kel*qpl_s - s*qpl_s + (Nh0*Rh*fplh)/s - (Nc0*Rc*fplc)/(Kgr - s);
S = solve (L_s,qpl_s);
this gets me a solution of qpl_s as
S =
(qpl(0) + (Nh0*Rh*fplh)/s - (Nc0*Rc*fplc)/(Kgr - s))/(Kel + s)
Walter Roberson
le 17 Mai 2016
Yes, changing from function to variable is the way to proceed. MrCov, you should repost as an Answer
Réponse acceptée
FannoFlow
le 17 Mai 2016
Was the error that it couldn't find an explicit solution? If so, thats because when it tried so solve, it simply couldn't find any way to solve for qpl(s).
Speaking of which, I'm not sure what you are trying to do with your notation, but if you are writing L(s) meaning that L is a function of s, try writing those variables as X_s instead, which declares them as variables in the workspace which Matlab can interpret and solve for.
syms Kel Nh0 Rh fplh Nc0 Rc fplc Kgr real
syms qpl_s s
L_s = qpl(0) - Kel*qpl_s - s*qpl_s + (Nh0*Rh*fplh)/s - (Nc0*Rc*fplc)/(Kgr - s);
S = solve (L_s,qpl_s);
this gets me a solution of qpl_s as
S =
(qpl(0) + (Nh0*Rh*fplh)/s - (Nc0*Rc*fplc)/(Kgr - s))/(Kel + s)
1 commentaire
Esraa Abdelkhaleq
le 18 Mai 2016
Modifié(e) : Walter Roberson
le 18 Mai 2016
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Special Values dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!