Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

??? Index exceeds matrix dimensions.

1 visualización (últimos 30 días)
john
john el 9 de Dic. de 2011
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentario
Dr. Seis
Dr. Seis el 9 de Dic. de 2011
1. What variable is the error associated with?
2. Where do you define "T" above?

Respuestas (1)

Dr. Seis
Dr. Seis el 9 de Dic. de 2011
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?

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by