Undefined function or variable but variable is defined

4 ビュー (過去 30 日間)
Andrew Piazza
Andrew Piazza 2019 年 7 月 14 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 14 日
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 日
Still, f is undefined here

サインインしてコメントする。

回答 (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.. :)

カテゴリ

Help Center および File ExchangeElementary Math についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by