MATLAB: How to solve system of 3 differential equations

differential equations

dx1/dt = r*x1 + p* (x2-x1) dx2/dt = r*x2 + p* (x1+x3-2*x2) dx3/dt = r*x3 + p* (x2-x3)

Best Answer

Hi , the following equations are solved symbolically and unknown constants arise because no initial conditions were provided:
syms x1(t) x2(t) x3(t) p r
eqn1 = diff(x1) == r*x1 + p* (x2-x1)
eqn2 = diff(x2) == r*x2 + p* (x1+x3-2*x2)
eqn3 = diff(x3) == r*x3 + p* (x2-x3)
eqns = [eqn1 eqn2 eqn3]
[x1, x2, x3] = dsolve(eqns)
Related Question