Why 'solve' function does not work with me
2 views (last 30 days)
Show older comments
Esraa Abdelkhaleq
on 17 May 2016
Edited: Walter Roberson
on 18 May 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 Comments
FannoFlow
on 17 May 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
on 17 May 2016
Yes, changing from function to variable is the way to proceed. MrCov, you should repost as an Answer
Accepted Answer
FannoFlow
on 17 May 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 Comment
More Answers (0)
See Also
Categories
Find more on Special Values in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!