What is causing Invalid variable 'conjugate(B(t))' in Symbolic Math Toolbox?

2 次查看(过去 30 天)
While trying to solve a DAE system with Symbolic Math Toolbox, I keep getting the same error. Unfortunately, the error message does not appear that much on the web. I am on Matlab R2018a.
Error using symengine
Invalid variable 'conjugate(B(t))'.
I did follow the example from Documentation exactly. Other ODEs work, but not this one. For instance, here is a working example:
% Differential Variables
syms A(t) B(t) C(t) D(t)
% Algebraic Variables
syms rho_1(t) rho_2(t) rho_3(t) rho_4(t)
% Model Parameters
syms k_1 k_2 k_3 k_4
diffEquations = [-rho_1(t) == diff(A(t), t),...
2*rho_1(t) - 2*rho_2(t) + 2*rho_3(t) - rho_4(t) == diff(B(t), t),...
rho_2(t) - rho_3(t) == diff(C(t), t),...
rho_4(t) == diff(D(t), t)];
rateEquations = [k_1*A(t) == rho_1(t), k_2*B(t) == rho_2(t),...
k_3*C(t) == rho_3(t), k_4*B(t) == rho_4(t)];
myModel = [diffEquations rateEquations];
diffVars = [A(t) B(t) C(t) D(t)];
[M, F] = massMatrixForm(myModel, diffVars)
And here's my code (MWE) of the non-working example, which throws the above-mentioned error:
% Differential Variables
syms B(t) C(t) E(t) L(t)
% Parameters and Inputs
syms nu_54 nu_64 nu_74 nu_81 nu_82 nu_83
syms k_1 k_2 k_3 k_4
syms vol q_in B_in C_in E_in L_in
% Rates (algebraic)
syms rho_1(t) rho_2(t) rho_3(t) rho_4(t)
% Differential Equations
diffEquations = [nu_81*rho_1(t) + nu_82*rho_2(t) + nu_83*rho_3(t) - rho_4(t)...
+ q_in/vol*(B_in - B(t)) == diff(B(t), t),...
-rho_1(t) + nu_54*rho_4(t) + q_in/vol*(C_in - C(t)) == diff(C(t), t),...
-rho_2(t) + nu_64*rho_4(t) + q_in/vol*(E_in - E(t)) == diff(E(t), t),...
-rho_3(t) + nu_74*rho_4(t) + q_in/vol*(L_in - L(t)) == diff(L(t), t)];
% Rate Equations
rateEquations = [k_1*C(t) == rho_1(t), k_2*E(t) == rho_2(t),...
k_3*L(t) == rho_3(t), k_4*B(t) == rho_4(t)];
% Combining everything
diffVars = [B(t) C(t) E(t) L(t)]';
myModel = [diffEquations rateEquations];
[M, F] = massMatrixForm(myModel, diffVars)
Any suggestions what the error means, what causes it and and how to fix it?

采纳的回答

Walter Roberson
Walter Roberson 2019-1-22
They have
diffVars = [A(t) B(t) C(t) D(t)];
You have
diffVars = [B(t) C(t) E(t) L(t)]';
Remember that ' is the complex conjugate transpose and that plain transpose is .' not '

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by