Undefined function or variable but variable is defined

I am getting an error message saying u1 isn't defined but it clearly is right above. Why is this error message ocurring?
I left out some of the initial conditions but they are irrelevent for the question at hand.
N0=f(1,1);
u0=f(2,1);
GTR = 51;
deltax = L/GTR;
B = 0.5;
t = 0;
for k = 1:GTR
t=t+deltax;
n1 = N0 - deltax*(B*c*LoadFunctionCP(t-deltax,L,type)+(1-B)*c*LoadFunctionCP(t,L,type));
ul = u0 +((deltax/EA)*(B*N0+(1-B)*n1))
u0 = u1;
N0 = n1;
storage2(k,:) = [t-deltax N0 u0];
end
Undefined function or variable 'u1'.
Error in file (line 120)
u0 = u1;

Réponses (1)

KALYAN ACHARJYA
KALYAN ACHARJYA le 14 Juil 2019
Modifié(e) : KALYAN ACHARJYA le 14 Juil 2019
one is ul and other is u1
ul = u0 +((deltax/EA)*(B*N0+(1-B)*n1)); % This is UL
u0 = u1; % This is U1
Hehe.. :)

Catégories

En savoir plus sur Graph and Network Algorithms dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by