How to express a variable (function) in terms of specific variables?
조회 수: 8(최근 30일)
표시 이전 댓글
I wish to return r1 as a function of all the symbolic variables under syms besides the [C_S, C_CS, C_BS]. But I am not exactly sure of how I should proceed.
The code below returns 4 zero solutions, which is technically correct. But the thing is that r1 is not 0, it is a function, and thus I need a function in all the symbolic variables with known IVPs.
syms C_S C_CS C_BS C_C C_P C_B r1 r2 r3 k_A k_A1 k_S k_S1 k_D k_D1
Ct = C_S + C_CS + C_BS
func1 = k_A*C_C*C_S - k_A1*C_CS
func2 = k_S*C_CS - k_S1*C_BS*C_P
func3 = k_D*C_BS - k_D1*C_B*C_S
Eq1 = [func1 == r1, func2 == 0, func3 == 0, Ct]
KA = k_A/k_A1
KS = k_S/k_S1
KD = k_A/k_D1
[x, y, z, w] = solve(Eq1, [r1 C_S C_CS C_BS])
답변(1개)
Paul
2021년 11월 26일
syms C_S C_CS C_BS C_C C_P C_B r1 r2 r3 k_A k_A1 k_S k_S1 k_D k_D1
Ct = C_S + C_CS + C_BS
r1 = k_A*C_C*C_S - k_A1*C_CS;
r2 = k_S*C_CS - k_S1*C_BS*C_P;
r3 = k_D*C_BS - k_D1*C_B*C_S;
sol = solve([r2==0,r3==0],[C_CS C_S],'ReturnConditions',true)
r1 = subs(r1,[C_CS C_S],[sol.C_CS sol.C_S])
[num,den]=numden(r1)
r1 = num/den
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!