Help! Z must be a matrix, not a scalar or vector?
Afficher commentaires plus anciens
hello i'm trying to heat conduction 3d using matlab 2010
clc
Lx=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:100
for 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
end
surf(T)
colorbar
drawnow
end
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.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!