% Optimal Foraging
clear;
t = 0:0.1:5;
c = 5;
M = 0:1:20;

for i = 1:length(t)
   for j = 1:length(M)
       y(j,i) = (1 + c*(t(i)+M(j)))*exp(-c*t(i)) - 1;
   end
end

surface(t,M,y)
xlabel('t')
ylabel('M')
