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;

Answers (1)

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.. :)

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

Asked:

on 14 Jul 2019

Edited:

on 14 Jul 2019

Community Treasure Hunt

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

Start Hunting!