
function DYDT=f(t,y)
% This is file conctank.m
% Concentration response of tank with no reaction
% INPUT: Time t and state vector y
% OUTPUT: derivatives DYDT
%
% Usage with odeeuler: [T,Y]=odeeuler('conctank',[0 20],0.9,0.1)
% Usage with ode15s:   [T,Y]=  ode15s('conctank',[0 20],0.9)
% Plot results:        plot(T,Y)

% I. Data (parameters and independent variables)
V=5;     % tank volum
q=1;     % volumetric flowrate
tau=V/q; % residence time
cai=1;   % inlet concentration for t>0

% II. Extract present value of states
ca=y;    % tank concentration

% III. Evaluate derivatives of states
f= (cai - ca)/tau;
DYDT=f;

