I have this code block to solve a steady-state biofilter system analytically.
syms C(x) mu D L KH Cg Da
DC = diff(C, x);
D2C = diff(C, x, 2);
ode = D2C == mu/D;
cond1 = C(0) == Cg/KH;
cond2 = DC(L) == 0;
C(x) = dsolve(ode, cond1, cond2);
fprintf('b) Analytical solution for the steady-state condition:\n');
fprintf('C(x) = %s\n\n', char(C(x)));
It gives me an equation; however, I have something called dimensionless Damköhler number which can be defined as:
DaTerm = mu * L^2 * KH / (D * Cg);
This term should be integrated into the concentration function after the function is divided by (Cg/KH) term. Therefore,
% Divide by Cg/KH
C(x) = C(x) / (Cg/KH);
% Simplify the solution
C(x) = simplify(C(x), 'Steps', 100);
% Print the simplified solution
fprintf('Simplified solution after divided by (Cg/KH):\n');
fprintf('C(x) = %s\n\n', char(C(x)));
And I get as console output:
Simplified solution after divided by (Cg/KH):
C(x) = 1 - (KH*mu*x*(2*L - x))/(2*Cg*D)
And it is very close to what I need. My problem is, there is no direct DaTerm in the given equation, and when I try to substitute using subs function, it gives me the same equation as expected.
My question is: is there a better solution to my problem, is there a way to edit simplify function in accordance to what I need in the equation, can I force subs function to substitute the equation in terms of what I need? Thank you so much for your time in advance.