Why 'solve' function does not work with me
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Esraa Abdelkhaleq
am 17 Mai 2016
Bearbeitet: Walter Roberson
am 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 Kommentare
FannoFlow
am 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
am 17 Mai 2016
Yes, changing from function to variable is the way to proceed. MrCov, you should repost as an Answer
Akzeptierte Antwort
FannoFlow
am 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 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Special Values 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!