MATLAB: How could I use ode45 to solve a system of three differential eqns in which one differnatial equation has a diferent time span

chemical engineeringdifferential equationsdsolvekineticsode45

For example:
1#: dx/dt = x+y+z tspan = [0 tf]
2#: dy/dt = x+y+z tspan = [0 tf]
3#: dz/dt = x+y+z tspan = [t1 tf]

Best Answer

Is z a constant before t1? If so then you have a situation where the derivative is not continuous. To handle that you need to break up the system into two ode45 calls, one for up to t1 and the other for t1 to tf.
For these purposes it does not matter if you use two different ode functions for the two parts, or if you use a single ode function that figures out which part it is operating in, as long as the behavior of the function does not change within one ode45 call.