hello i'm trying to heat conduction 3d using matlab 2010
clcLx=1; Ly=1;Lz=1;M=10;N=10;Z=10;Q=zeros(M,N,Z);Q(M,N,Z)=100;%Dx=Lx/M;
%Dy=Ly/N;
%Dz=Lz/Z;
T=400*ones(M,N,Z);T(:,:,1)=500; %boundary temperature
for i=1:100for m=2:M-1 for n=2:N-1 for z=2:Z-1 T(m,n,z) = (100/6) * ( (T(m-1,n,z)+T(m+1,n,z)+T(m,n-1,z)+T(m,n+1,z)... +T(m,n,z+1)+T(m,n,z-1)))+ Q(m,n,z); end end endsurf(T)colorbardrawnowend
and i can't solve the error 'z is not a matrix' and 'CData must be an M-by-N matrix or M-by-N-by-3 array'. what's wrong in this code? code means that set initial temperature and heat the domain plus Q.
Best Answer