function [CH,CO,TO,t,x]=order(TO,t,CH,x,h,Q,CO,k,c) % process when order of Q items arrive at time TO (see inventory.m) CH=CH+x*h*(TO-t); %update holding costs since last event t=TO; x=x+Q; %update clock and inventory CO=CO+k+c*Q; % increment costs of order TO=10^10; % Schedule next order at infinity.