% % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- addpath('../../BookCode'); close all; clc; clear; % Problem EPage 118 ; example using heat on EPage 112 % K = 1; nx = 20; % 20 division of x hx = 1/nx; ht = 0.01; % t = 0:0.01:0.5; nt = 50; init = zeros(1,nx+1); init(end) = 10; % u(x,0) = 0 but x=1 where u(1,0) = 10 lowb = 0; % u(0,t) = 0 hib = 10; % u(1,t) = 10 u = heat(nx,hx,nt,ht,init,lowb,hib,K); surf(u); axis( [ 0 20 0 50, 0, 12 ] ); xlabel('x - node number'); ylabel('time - node number'); zlabel('temperature'); %saveas( gcf, '../../WriteUp/Graphics/Chapter6/c_6_p_6_plot.eps', 'epsc' );