Info
此问题已关闭。 请重新打开它进行编辑或回答。
problem with for loop
1 次查看(过去 30 天)
显示 更早的评论
Hi I have problem with for loop ; when i run this code,i think probably one loop does not stop and matlab stays on busy mode i want to understand where is the problem in my program (i attached all functions to this question)
a part of code:
for i=2:length(x)-1
for j=2:length(y)-1
z = 0:0.1:1;
for zindex=1:11
for nindex = [1,10]
u(i, j, 2, zindex+1, nindex)= G(z(zindex), nindex)/ro(z(zindex), nindex)^2*dt^2*((1/deltar^2)*(u(i+1,j,1)-2*u(i,j,1)+u(i-1,j,1))...
+(1/(ri*2*deltar))*(u(i+1,j,1)-u(i-1,j,1))+(1/deltaz^2)*(u(i,j+1,1)-2*u(i,j,1)+u(i,j-1,1))-(1/ri^2)*(u(i,j,1))) + 2*u(i,j,1) - u(i,j,1);
end
end
end
end
for n=2:length(t)-1
for i=2:length(x)-1
for j=2:length(y)-1
z = 0:0.1:1;
for zindex=1:11
for nindex = [1,10]
u(i,j,n+1,zindex+1,nindex)= G(z(zindex), nindex)/ro(z(zindex), nindex)^2*dt^2*((1/deltar^2)*(u(i+1,j,n)-2*u(i,j,n)+u(i-1,j,n))...
+(1/(ri*2*deltar))*(u(i+1,j,n)-u(i-1,j,n))+(1/deltaz^2)*(u(i,j+1,n)-2*u(i,j,n)+u(i,j-1,n))-(1/ri^2)*(u(i,j,n))) + 2*u(i,j,n) - u(i,j,n-1);
end
end
end
end
end
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!