% Heat transfer with convection, heatc1.m clear % variables format short e % E format temp1=70 % inside temperature temp4=20 %outside temperature kxx = 0.5; % thermal conductivity len = (0.25/12); hf = [2 10] % film coefficient k12 = hf(1); % therm cond, length k23 = kxx / len; k34 = hf(2); k22 = k12 + k23; k33 = k23 + k34 beta = k12*1e7 % zienk factor stiff = [ k12 -k12 0 0 % stiffness matrix -k12 k22 -k23 0 0 -k23 k33 -k34 0 0 -k34 k34 ] df = [ temp1*beta; 0; 0; temp4*beta ]; % combined zienk = stiff; zienk(1,1)=zienk(1,1)+beta; zienk(4,4)=zienk(4,4)+beta format short temp = inv(zienk) * df; % displacements heat = stiff * temp % force vector % print the results fprintf('\n Heatc1, add convection ') fprintf('\n Your name, MENG 421, ') disp(date) fprintf('\n Node Temp Heat') fprintf('\n F Btu/Hr\n') for i = 1:length(df) disp(sprintf(' %2.0f %7.2f %7.2f',i,temp(i),heat(i))) end % Heatc1, add convection % Your name, MENG 421, 05-Feb-2004 % Node Temp Heat % F Btu/Hr % 1 70.00 77.92 % 2 31.04 0.00 % 3 27.79 0.00 % 4 20.00 -77.92