clear all; clc; %Total heat flow through bottom edge qy_bot = dlmread('qy_bot.txt','',1,1); q_bot_tot = trapz(qy_bot(:,1), qy_bot(:,2)); fprintf(1,'Total heat flow through bottom edge = %7.4f\n',q_bot_tot); %Total heat flow through right edge qx_right = dlmread('qx_right.txt','',1,1); q_right_tot = trapz(qx_right(:,1), qx_right(:,2)); fprintf(1,'Total heat flow through right edge = %7.4f\n',q_right_tot); figure(1); clf; h1 = plot(qy_bot(:,1), qy_bot(:,2),'-k'); hold on; h2=plot(qx_right(:,1), qx_right(:,2),'--r'); set(gca,'Box','on','LineWidth',2,... 'FontName','Helvetica',... 'FontSize',14); %Set axis properties set(h1,'LineWidth',2); %Set linewidth for curve set(h2,'LineWidth',2); xlabel('Distance along path'); ylabel('Heat flux'); title('Heat flux variation for 2D conduction'); axis square; %Make axis box square legend('Bottom edge','Right edge'); axis([0 2 0 14]);