MATLAB: Problem with symbolic function that it’s been calculated and cannot be re-used for further calculation by the script file

problem in further using the solution of an ode in a script filesolving symbolically ode

%I would like to calculate CA, CB, CP, CZ
clear
syms CA CB CP CZ t
disp([' ']);
disp(['ODE - Chemical Kinetics 1st assignment on matlab']);
disp([' ']);
eqn1 = 'DCA = -CA';
CA = (dsolve(eqn1,'CA(0)=10','t'));
%disp(['H sugkentrwsi tou CA sunarthsei tou xronou gia thermokrasia 80oC
einai:']);
CA
eqn2= 'DCB = CA-CB';
CB = (dsolve(eqn2,'CB(0)=0','t'));
%disp(['H sugkentrwsi tou CB sunarthsei tou xronou gia thermokrasia 80oC
einai:']);
CB
eqn3= 'DCP = (CB-CP';
CP = (dsolve(eqn3,'CP(0)=0','t'));
%disp(['H sugkentrwsi tou CP sunarthsei tou xronou gia thermokrasia 80oC
einai:']);
CP
eqn4= 'DCZ = CP';
CZ = (dsolve(eqn4,'CZ(0)=0','t'));
%disp(['H sugkentrwsi tou CZ sunarthsei tou xronou gia thermokrasia 80oC
einai:']);
CZ

Best Answer

eqn2= subs(sym('DCB = CA-CB'));
eqn3= subs(sym('DCP = (CB-CP)'));
eqn4 = subs(sym('DCZ = CP'));
Related Question