Info

この質問は閉じられています。 編集または回答するには再度開いてください。

??? Index exceeds matrix dimensions.

1 回表示 (過去 30 日間)
john
john 2011 年 12 月 9 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi could anyone tell me what is wrong with my script?
I'm not bvvery good at Matlab so i apologize if this is obvious.
for i=(PRINT_TIME:PRINT_TIME:TOTAL_TIME); for j=(DELTA_TIME:DELTA_TIME:PRINT_TIME);
c=1; x(c)=2*(F*c)+(1-2*F)*c; for c=(2:N-1);
c>=(2);
c<=(N-1);
c = F*(c(c+1)+c(c-1))+(1-2*F)*c;
end;
c=N; x1=x; x1(N)=2*F(c(N-1)+B*FLUID_TEMP)+(1-2*F-2*B*F)*c;
end;
time_new=TIME+PRINT_TIME; TIME=time_new; fprintf ('T = %d seconds \n', T); disp(y) end;
  1 件のコメント
Dr. Seis
Dr. Seis 2011 年 12 月 9 日
1. What variable is the error associated with?
2. Where do you define "T" above?

回答 (1 件)

Dr. Seis
Dr. Seis 2011 年 12 月 9 日
You are not creating any x beyond x(1). In your inner "for" loop you have:
c = F*(c(c+1)+c(c-1))+(1-2*F)*c;
Which probably should be:
x(c) = F*(c(c+1)+c(c-1))+(1-2*F)*c;
The following are doing nothing and can be deleted:
c>=(2);
c<=(N-1);
Unless you meant to set up and "if" statement?

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by