Effacer les filtres
Effacer les filtres

How to optimize this code?

2 vues (au cours des 30 derniers jours)
Vadim Potorocha
Vadim Potorocha le 14 Nov 2020
Commenté : Vadim Potorocha le 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

Réponse acceptée

Ameer Hamza
Ameer Hamza le 14 Nov 2020
Modifié(e) : Ameer Hamza le 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.
  1 commentaire
Vadim Potorocha
Vadim Potorocha le 14 Nov 2020
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by