function D = Demand(mean,amplitude,Dmin,Dmax,T)
t = 0:T;
D = mean + amplitude * sin(2*2*pi*t/T -pi/2) + normrnd(0,20,[1,T+1]);
D = min(max(D,Dmin),Dmax);
end

