# Matlab programming 24 hours

%Steady State, 2D problem %0.4m x 0.6m bar %Left side is perfectly insulated W=0.4 L=0.6 l=0.1; %dx=dy=0.1m h=100; %heat convection coefficient K=2; %heat conduction coefficient Ta=20; %Ambient Temperature Ts=200; %Surface Temperature c=h*l/K q=2+c r=2*q s=c*Ta A=[-4 2 0 0 0 1 0 0 0 0 0 0 0 0 0; %n6 1 -4 1 0 0 0 1 0 0 0 0 0 0 0 0; %n7 0 1 -4 1 0 0 0 1 0 0 0 0 0 0 0; %n8 0 0 1 -4 1 0 0 0 1 0 0 0 0 0 0; %n9 0 0 0 2 -r 0 0 0 0 1 0 0 0 0 0; %n10 1 0 0 0 0 -4 2 0 0 0 1 0 0 0 0; %n11 0 1 0 0 0 1 -4 1 0 0 0 1 0 0 0; %n12 0 0 1 0 0 0 1 -4 1 0 0 0 1 0 0; %n13 0 0 0 1 0 0 0 1 -4 1 0 0 0 1 0; %n14 0 0 0 0 1 0 0 0 2 -r 0 0 0 0 1; %n15 0 0 0 0 0 2 0 0 0 0 -4 2 0 0 0; %n16 0 0 0 0 0 0 2 0 0 0 1 -4 1 0 0; %n17 0 0 0 0 0 0 0 2 0 0 0 1 -4 1 0; %n18 0 0 0 0 0 0 0 0 2 0 0 0 1 -4 1; %n19 0 0 0 0 0 0 0 0 0 2 0 0 0 1 -q]; %n20 B=[-Ts; -Ts; -Ts; -Ts; -s-Ts; 0; 0; 0; 0; -2*s; 0; 0; 0; 0; -s]; T=A\B disp('Temperature distribution using increments of 0.1m (from T1 - T15):') for i = 0:1:14 disp ('T = ') disp (T(1+i)) end NC=[200 200 200 200 200; T(1) T(2) T(3) T(4) T(5); T(6) T(7) T(8) T(9) T(10); T(11) T(12) T(13) T(14) T(15); T(6) T(7) T(8) T(9) T(10); T(1) T(2) T(3) T(4) T(5); 200 200 200 200 200]; g=[50 100 150]; X=linspace(0,W,5); Y=linspace(0,L,7); figure contourf(X,Y,NC,g) colorbar xlabel('Width of Plate (m)') ylabel('Length of Plate (m)') title('Temperature Distribution of the Metal Plate')