I am trying to plot the heat flow through a plate, but for some odd reason I am getting a weird flow line on the cold side (lower right corner). Could somebody check the code for me? I have added a screenshot of the plot I am getting.
Also, How could I add a "hole" in this plot? An area which cannot be affected by the heat flow.
%Predefined Variables
dx = 1;dy = 1; %Plate dimensions
plate_length = 64;plate_height = 96; %Heated & Cooled points
heated_length = 32;heated_height = 32;cooled_length = 16;cooled_height = 16;heated_temp = 100;cooled_temp = -100; %Grid
x = 0:dx:plate_length;y = 0:dy:plate_height;nx = length(x);ny = length(y);[x_arr, y_arr] = meshgrid(x,y);temp=zeros(ny, nx); %Heating & Cooling Points
heated_top = find((y_arr == plate_height) & (x_arr <= heated_length));heated_left = find((y_arr >= plate_height-heated_height) & (x_arr == 0));heated_points = union(heated_top, heated_left);cooled_bottom = find((y_arr == 0) & (x_arr >= plate_length-cooled_length));cooled_right = find((y_arr <= cooled_height) & (x_arr == plate_length));cooled_points = union(cooled_bottom, cooled_right);temp(heated_points) = heated_temp;temp(cooled_points) = cooled_temp; %Iteration
for k=1:1:30inner_x = 2:nx-1;inner_y = 2:ny-1;x_diff = temp(inner_y, inner_x+1) + temp(inner_y, inner_x-1);y_diff = temp(inner_y+1, inner_x) + temp(inner_y-1, inner_x);old_inner = temp(inner_y, inner_x);temp(inner_y, inner_x) = (x_diff +y_diff)/4; %Plotting
contourf(x_arr,y_arr,temp);%surf(x_arr,y_arr,temp);
%contour(x_arr,y_arr,temp);
%hold on;
drawnow;end
Best Answer