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;

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 7월 14일
편집: KALYAN ACHARJYA 2019년 7월 14일
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.. :)

카테고리

도움말 센터File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

질문:

2019년 7월 14일

편집:

2019년 7월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by