Solving a system of differential equations
6 views (last 30 days)
Show older comments
Context: r is radius of a particle and C is the concentration in a solution - the below is a form of the Noyes-Whitney equation, but solving for the changing particle radius and concentration dynamically.
I would like to solve this set of differential equations simultaneously for both C and r with time (t). Eventually I would like to plot both variables with time. All the other parameters are constant.

Note: dr^3/dt is the derivative of r^3 with respect to t
2 Comments
Walter Roberson
on 6 Oct 2019
To confirm, is
to be
cubed, or is it the triple differentiation of r with respect to t, or is it the derivative of
with respect to t ?
Answers (1)
Walter Roberson
on 6 Oct 2019
syms r(t) C(t)
Pi = sym('pi');
dr_cubed = diff(r^3,t);
dC = diff(C,t);
eqn1 = dr_cubed == -3*D*C_s/(rho*r0^2)*r*(1-C/Cs);
eqn2 = dC == D*4*Pi*r0*N*(1-C/Cs)*r/V;
sol = dsolve([eqn1, eqn2, r(0)==r0, C(0)==Cs]); %not sure I got the right initial conditions
2 Comments
Walter Roberson
on 6 Oct 2019
If there is no closed form solution, then I recommend looking at the documentation for odeFunction https://www.mathworks.com/help/symbolic/odefunction.html which shows the steps to use to convert symbolic equations into anonymous functions that can be handled by ode45() and kin.
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!