I am using ode45
to solve a simple ODE:
function dCdt=u_vent(t,C)
if t> 600 && t<= 720
Q=Q2;
elseif t> 1320
If you have the Signal Processing Toolbox, you can use something like:
>> t = 0:3600;
>> y = pulstran(t,[660:720:3600],'rectpuls',120);
>> plot(t,y)
>> ylim([-0.1 1.1])
which gives the following (in Octave, should be the same in MATLAB):
You then need to scale y
to be between Q1
and Q2
instead of 0 and 1.