Solving a system of differential equations

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

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 ?
Hi there - It is the derivative of r^3 with respect to t.

Sign in to comment.

Answers (1)

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

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.
Thanks very much, but is there a way to do it without the Symbolic Math Toolbox?

Sign in to comment.

Asked:

on 6 Oct 2019

Commented:

on 7 Oct 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!