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

3 Ansichten (letzte 30 Tage)
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!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 11 Jun. 2018
You forgot some multiplication operations when you defined formulas. MATLAB does not have any implied multiplication.

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox 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!

Translated by