I have two coupled systems composed of four linear differential equations. How do you use a stiff ode to solve these four equations simultaneously?
m is a constant value
x1' = m * [y1 + x1 – x2];
y1' = -1/m * [x1 + y1];
x2' = m * [y2 + x2 – x1];
y2' = -1/m * [x2 + y2];
I solved the differential equation for one system, the code is as follows:
f = @(t,y) [m * (y(2) + y(1) – z); (-1/m) * ( y(1) + y(2)) ];
g = @(y) f(0,y);
[T Y] = ode15s(f, [0 80], [0, 0]);
In this case, z was a constant. However, the solution of the first system is now dependent on the second (x2).
Best Answer