assigning element in 3D matrix
Show older comments
I need to assign element in 3 D matrix that have size (x,y,z)
Index in position 3 exceeds array bounds (must not exceed 1).
for example
nz =3
nx=2
ny=3
Tz_D = zeros(nx,ny,nz);
mobility_X = Kx./(B_O.*mu); % (nx,ny,nz)
mobility_Y = Ky./(B_O.*mu); % (nx,ny,nz)
mobility_Z = Kz./(B_O.*mu); % (nx,ny,nz)
for i = 1:nx
for j=1:ny
for k=1:nz
if k < nz
Tfz_U(i,j,k) = 2* mobility_Z(:,:,k+1)* mobility_Z(:,:,k)/( mobility_Z(:,:,k+1)+ mobility_Z(k,:,:)); %Tf_k- %Tf_k-
Tz_U(i,j,k) = 0.00633*Tgz*Tfz_U(i,j,k);
% T_j-
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!