Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
??? Index exceeds matrix dimensions.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
2011년 12월 9일
1. What variable is the error associated with?
2. Where do you define "T" above?
답변 (1개)
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?
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!