Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

??? Index exceeds matrix dimensions.

1 vue (au cours des 30 derniers jours)
john
john le 9 Déc 2011
Clôturé : MATLAB Answer Bot le 20 Août 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 commentaire
Dr. Seis
Dr. Seis le 9 Déc 2011
1. What variable is the error associated with?
2. Where do you define "T" above?

Réponses (1)

Dr. Seis
Dr. Seis le 9 Déc 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?

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by