- y1a = zeros(1,100); offers no advantage. It adds to the execution time.
- "cube operation" is not affected by "variable declaration"
Info
此问题已关闭。 请重新打开它进行编辑或回答。
Brief question: faster to zero before direct computation?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
per isakson
2014-12-18
编辑:per isakson
2014-12-18
Not just confusing. It was wrong; a "no" was missing. I've edited the comment.
回答(0 个)
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!