Lab 13
Lab 13
m 1 of 2
clc;
clear;
%% Parameters
L = 1; % Length of plate (m)
Nx = 20; % Number of grid points in x-direction
Ny = 20; % Number of grid points in y-direction
alpha = 122.0e-3; % Thermal diffusivity (m^2/s)
dx = L / (Nx - 1);
dy = L / (Ny - 1);
dt = 0.25 * (dx^2 * dy^2) / (alpha * (dx^2 + dy^2)); %
Stability condition
time_steps = 4000;
%% Time-stepping loop
for t = 1:time_steps
T_old = T;
for i = 2:Nx-1
for j = 2:Ny-1
4/18/25 10:22 PM C:\...\Lab13.m 2 of 2
%% Visualization
[X, Y] = meshgrid(linspace(0, L, Nx), linspace(0, L,
Ny));
figure;
contourf(X, Y, T, 20, 'LineColor', 'none');
colormap(jet);
colorbar;
caxis([25 50]);
axis equal;
title('2D Heat Diffusion in Mild Steel Plate');
xlabel('X (m)');
ylabel('Y (m)');