How to optimize this code?

1 次查看(过去 30 天)
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by