Hey in a project I am trying to build a 3d matrix based off another 3d matrix to find a final temperature profile. The code up to the error is:
X = 0:0.1:5;Y = 0:0.1:1;Z = 0:0.1:20;layer = zeros(length(X),length(Y));layer1 = layer;layers = layer;layer1(:,:) = 52;layers(:,:) = 22;temperature_profile(:,:,1) = layer1;for x = 2:length(Z) temperature_profile(:,:,x) = layers;endlayers2 = layer;layers2(:,:) = 1;for x = 1:length(Z) temperature_profile2(:,:,x) = layers2;endH = zeros(length(X),length(Y),length(Z));H(:,:,:) = 0.0000001;G = ones(length(X),length(Y),length(Z));V = temperature_profile2-temperature_profile;t = 0;Cp = 1;V = 1;A = 1;rho = 1;h = 1;T0 = 22;T1 = 52;k = 1;T = V < H;while T ~= G for z = 2:length(Z) for y = 1:length(Y) for x = 1:length(X) if z == 1 temperature_profile2(x,y,z) = 52; elseif z == 2 if y == 1 if x == 1 temperature_profile2(x,y,z) = ((0.00001)./(V.*rho.*Cp)).*(V.*k.*((((temperature_profile(x+2,y,z)-temperature_profile(x,y,z))./(0.2^2)))+(((temperature_profile(x,y+2,z)-temperature_profile(x,y,z))./(0.2^2)))+(((temperature_profile(x,y,z+2)-3.*temperature_profile(x,y,z)+2.*temperature_profile(x,y,z-1))./(4.*(0.2^2))))+A.*h.*(T0-T1)))+temperature_profile(x,y,z);
when it is run the Assignment has more non-singleton rhs dimensions than non-singleton subscripts mean error pops up and i'm not really sure what it means.
Best Answer