Errors during solving equations - sym/subsindex (line 796) and sym/subsref (line 841)

Hello, I need to solve the equations, in order to find Cadt and Cbdt. My code is:
syms Cadt Cat Cbdt Cbt dt Maa Mab Mbb k ga gb KA KB KC
eqn1 = (Cadt-Cat)/dt == Maa*(-k^2*ga - 2*(KA+KC)*k^4*Cadt - 2*KC*k^4*Cbdt) + Mab(-k^2*gb - 2*KC*k^4*Cadt - 2*(KB+KC)*k^4*Cbdt);
eqn2 = (Cbdt-Cbt)/dt == Mab*(-k^2*ga - 2*(KA+KC)*k^4*Cadt - 2*KC*k^4*Cbdt) + Mbb(-k^2*gb - 2*KC*k^4*Cadt - 2*(KB+KC)*k^4*Cbdt);
sol = solve([eqn1, eqn2], [Cadt, Cbdt]);
Sol1 = sol.Cadt
Sol2 = sol.Cbdt
However, I am getting theses errors:
Error using sym/subsindex (line 796)
Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables and the body of the function is a SYM expression. When indexing, the
input must be numeric, logical, or ':'.
Error in sym/subsref (line 841)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in Semi_implicit_conc_eqn_solve (line 8)
eqn1 = (Cadt-Cat)/dt == Maa*(-k^2*ga - 2*(KA+KC)*k^4*Cadt - 2*KC*k^4*Cbdt) + Mab(-k^2*gb - 2*KC*k^4*Cadt - 2*(KB+KC)*k^4*Cbdt);
It would be a great assistance if you let me know what went wrong in this code. Thanks a lot!

 채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 11일
You forgot some multiplication operations when you defined formulas. MATLAB does not have any implied multiplication.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2018년 6월 11일

댓글:

2018년 6월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by