What is causing Invalid variable 'conjugate(B(t))' in Symbolic Math Toolbox?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
winkmal
am 22 Jan. 2019
Beantwortet: Walter Roberson
am 22 Jan. 2019
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?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 22 Jan. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Equation Solving 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!