How to optimize this code?

8 ビュー (過去 30 日間)
Vadim Potorocha
Vadim Potorocha 2020 年 11 月 14 日
コメント済み: Vadim Potorocha 2020 年 11 月 14 日
u = (0:1500).*(96*(2*pi)/1500); % spiral with 96 waves
r=u./2; % spiral radius
x=r.* cos(u); % X
y=r.* sin(u); % Y

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 14 日
編集済み: Ameer Hamza 2020 年 11 月 14 日
Your code is already pretty optimized. However, you can replace the first line with
u = linspace(0, 96*2*pi, 1501)
I think this line is more readable compared to the one in your code.
  1 件のコメント
Vadim Potorocha
Vadim Potorocha 2020 年 11 月 14 日
Thanks

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by