MATLAB Answers

0

Undefined function or variable but variable is defined

Asked by Andrew Piazza on 14 Jul 2019
Latest activity Edited by KALYAN ACHARJYA on 14 Jul 2019
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 Comment

Still, f is undefined here

Sign in to comment.

Tags

1 Answer

Answer by KALYAN ACHARJYA on 14 Jul 2019
Edited by KALYAN ACHARJYA on 14 Jul 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.. :)

  0 Comments

Sign in to comment.