Why can I not evaluate this while loop?

t=0;
for w=35:5:45;
while (x<10) & (y<10);
x = exp(1.2)*cos(w*t);
y = t^3;
t=t+0.1;
end
t
end

 採用された回答

James Tursa
James Tursa 2015 年 9 月 11 日
編集済み: James Tursa 2015 年 9 月 11 日

0 投票

Did you mean to use cosd instead of cos? From your w values it looks like maybe w is in degrees. Also, I don't see x or y initialized. E.g., maybe start with x = exp(1.2) and y = 0 prior to the loop start?

1 件のコメント

Tuntoon
Tuntoon 2015 年 9 月 11 日
I totally forgot that how MATLAB handles radians and degrees. Thank you for the reminder.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

質問済み:

2015 年 9 月 11 日

コメント済み:

2015 年 9 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by