
clear				% Clear previous definitions
figure(1)           % Assign figure number
clf                 % Clear previous figures
hold off            % Start with fresh graph

mytitle = 'Greenhouse/Rockbed'; 	% Title
xlab = '$t$ hrs'; 		% X-label
ylab = 'Temperature ($^\circ$C)'; 		% Y-label

u0 = [5,25]';
[t,u] = ode23(@greenhouse,[0,10],u0); % simulate heat with ode23
tt = linspace(0,10,200);
u1 = -14.3077*exp(-1.75*tt)+3.3077*exp(-0.125*tt)+16; % solution u1
u2 = 2.3846*exp(-1.75*tt)+6.6154*exp(-0.125*tt)+16;

plot(t,u(:,1),'b-','LineWidth',1.5);  % Plot greenhouse air (numeric)
hold on                            % Plots Multiple graphs
plot(t,u(:,2),'r-','LineWidth',1.5);  % Plot greenhouse rocks (numeric)
plot(tt,u1,'c:','LineWidth',1.5);  % Plot greenhouse air, u1
plot(tt,u2,'m:','LineWidth',1.5);  % Plot greenhouse rocks, u2
plot([0 10],[16 16],'k:','LineWidth',1.5);  % Plot equilibrium
grid                                % Adds Gridlines
text(0.6,11,'$u_1$','color','blue','FontSize',14,...
    'FontName','Times New Roman','interpreter','latex');
text(3,22,'$u_2$','color','red','FontSize',14,...
    'FontName','Times New Roman','interpreter','latex');
legend('Air (numeric)','Rockbed (numeric)','Air (exact)',...
    'Rockbed (exact)','Location','Southeast');
xlim([0 10]);    % Defines limits of graph
ylim([0 30]);   % Defines limits of graph

fontlabs = 'Times New Roman';   % Font type used in labels
xlabel(xlab,'FontSize',14,'FontName',fontlabs,'interpreter','latex');  
        % x-Label size and font
ylabel(ylab,'FontSize',14,'FontName',fontlabs,'interpreter','latex');  
        % y-Label size and font
title(mytitle,'FontSize',16,'FontName','Times New Roman','interpreter','latex'); 
        % Title size/font
set(gca,'FontSize',12);         % Axis tick font size

%print -depsc greenhouse.eps		% Create figure as EPS file
%print -djpeg lake2.jpg		% Create figure as JPEG file

