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 symengineInvalid 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_4diffEquations = [-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 Variablessyms B(t) C(t) E(t) L(t)% Parameters and Inputs
syms nu_54 nu_64 nu_74 nu_81 nu_82 nu_83syms k_1 k_2 k_3 k_4syms 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?
Best Answer