I'm trying to draw isothermal lines and heat flow lines, I've done some research and was able to reach to this point:
clear ,clc
T1=10;
Lx=1;
Ly=1;
Nx=5;
Ny=5;
Nz=5;
Lz=1;
T2=150;
%input('input temperature at y=Ly in deg. C: ')
dx=Lx/Nx;
dy=Ly/Ny;
x=[0:dx:1];
y=[0:dy:1];
theta = zeros(Nx + 1, Ny + 1);
theta(:,Ny+1) = 1;
Nc=12;
for j = 2:Ny
for i = 2:Nx
for n=1:1:199
Theta=(2/pi).*x;
x=((((-1)^(n+1))+1/n).*sin(n.*pi.*x/Lx).* ...
(sinh(n.*pi.*y/Lx)/sinh(n.*pi.*Ly/Lx)));
T=(Theta*(T2-T1))+T1;
end
end
end
for j = Ny+1:-1:1
fprintf('%7.1f', T(:,j))
fprintf('\n')
end
dT = (T2-T1)/Nc;
v = T1:dT:T2;
colormap(jet)
contourf(x, y, T, v)
colorbar
Tmax = max(T1,T2)
Tmin = min(T1,T2)
caxis ([Tmin, Tmax])
axis equal tight
title('Contour Plot of Temperature in deg. C')
xlabel('x (m)')
ylabel('y (m)')
but I'm getting the following error when I try to run it:
76.6
10.0
10.0
10.0
10.0
10.0
Error using contourf (line 69)
Z must be size 2x2 or greater.
Error in Isotherms (line 35)
contourf(x, y, T, v)
any help will be appreciated, thanks in advance.