105 A(r,r-1) = 1; %node above
106 A(r,r) = -4; %current node
107 A(r,r+1) = 1; %node below
108 A(r,r-ny) = 2; %node to left, includes fictitious node
109 end
118
119 r = n; %bottom node, material 1
120 A(r,r) = 1; %sets temperature = 0
121 r=n+ny;%bottom node, material 2
122 A(r,r) = 1; %sets temperature = 0
131 %use backward differences for material 1
132 A(rtwo,rone-ny) = -k; A(rtwo,rone) = k; %k*dT/dx for …
material 1
133 %use forward differences for material 2 but remember – …
sign in equation
142 h = ny;
143 Tplot = zeros(w,h); %we don’t need to plot the interface twice
144
145 %get out the temperatures in material 1 and the interface
146 for i = 1:nx