Professional Documents
Culture Documents
end
A=gallery('tridiag',c,d,e); %Building Tri-diagonal Matrix%
T(j+1,i)=A\(transpose(C)); %Solving for Temperature Distribution at 0<x<L and at time t > 0 Sec%
end
B=[zeros(1,1);M];
H=[X;T];
Y=[B,H]; % Setting up Array to display Space Increment in along the First row except in the (1,1) cell, Time
level along the First Column, and The temp Distribution of the corresponding space level and the respective
time level%
J=[T(1,:);T(11,:);T(21,:);T(31,:);T(41,:);T(51,:)]; %Array of Temperature distribution along the Rod at time
levels 0,10,20,30,40,50 Seconds%
disp(Y)
Mid_Temp=T(:,(N+1)/2); % Array for Mid Point Temperature at all time levels %
plot(X,T) %Plot of x v/s T%
title('Variations in Temperature along the Rod in Different time levels')
xlabel('Space Increments along the Rod in mm') % x-axis label
ylabel('Temperature in Deg Celcius') % y-axis label
figure
plot(X,J)%Plot of x v/s T for time level t=0,10,20,30,40,50 sec%
title('Variations in Temperature along the Rod in time level t=1,10,20,30,40,50 Sec')
xlabel('Space Increments along the Rod in mm') % x-axis label
ylabel('Temperature in Deg Celcius') % y-axis label
figure
plot(M,Mid_Temp) % Plot of t vs Mid Point Temp (T[x/2]) %
xlabel('Time Level in seconds') % x-axis label
ylabel('Rod Mid Point Temperature in Deg Celcius') % y-axis label
else
fprintf('Warning!!!! - Unstability detected and your PC may blow up ');
end
xlswrite('D:\CFD ASSIGN1\TempBTCS.xlsx',Y) % Writing the calculations in an Excel file%