- y1a = zeros(1,100); offers no advantage. It adds to the execution time.
- "cube operation" is not affected by "variable declaration"
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Brief question: faster to zero before direct computation?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all, quick question,
in the simplest of examples,
x1a = linspace(-1,1,100);
y1a = zeros(1,100);
y1a = x1a.^3;
Is it a clear computational speed and economy advantage to declare y1a first with zeros, or not, in this simple case?
Is the cube operation one that does not require nor benefit from variable declaration?
Cheers
4 Kommentare
per isakson
am 18 Dez. 2014
Bearbeitet: per isakson
am 18 Dez. 2014
Not just confusing. It was wrong; a "no" was missing. I've edited the comment.
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!