Filter löschen
Filter löschen

How to optimize this code?

1 Ansicht (letzte 30 Tage)
Vadim Potorocha
Vadim Potorocha am 14 Nov. 2020
Kommentiert: Vadim Potorocha am 14 Nov. 2020
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

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 14 Nov. 2020
Bearbeitet: Ameer Hamza am 14 Nov. 2020
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.

Weitere Antworten (0)

Kategorien

Mehr zu Problem-Based Optimization Setup finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by