load temperature 
Tin = 72;
L = 2;
x = linspace(0,L,24); 

% Previous solution: use REPMAT
ttemp = repmat(temp,1,length(x));
xx = repmat(x,24,1);

% New solution: use MESHGRID
[xx2,ttemp2] = meshgrid(x,temp);

Tx2 = (Tin-ttemp2).*xx2./L+ttemp2;
surf(xx2,time,Tx2)