Matlab responds with 'busy'

7 ビュー (過去 30 日間)
Ben Hatrick
Ben Hatrick 2021 年 2 月 10 日
編集済み: Ben Hatrick 2021 年 2 月 10 日
When running the following code no output (graph) is given, instead matlab gives 'busy' in the bottem left hand corner. Any ideas?
if (x<=-d)
a = -g -s1*x/m_c -v*c/m_c + s2*x/m_c;
else a = -g -s1*x/m_c -v*c/m_c;
end
x = x + v*dt;
v = v + a*dt;
Disp(i)=x;
Vel(i)=v;
t=t+dt;
Time(i)=t;
i=i+1;
end
end
  1 件のコメント
Adam Danz
Adam Danz 2021 年 2 月 10 日
Learn to use Debug Mode to quickly solve these types of issues.

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 10 日
編集済み: Walter Roberson 2021 年 2 月 10 日
if (x<=-d)
when that is true, you do not change t, and you get caught in an infinite loop.
Perhaps you want an "end" immediately after the second assignment
if (x<=-d)
a = -g -s1*x/m_c -v*c/m_c + s2*x/m_c;
else
a = -g -s1*x/m_c -v*c/m_c;
end
  1 件のコメント
Ben Hatrick
Ben Hatrick 2021 年 2 月 10 日
Thank you so much, massive help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by