Page 1 of 1

Add to the following code its vectorized version: 1 % Start stopwatch timer tic A = zeros (1, 1000000); 2 3 4 6 7 for n

Posted: Sat May 14, 2022 2:49 pm
by answerhappygod
Add To The Following Code Its Vectorized Version 1 Start Stopwatch Timer Tic A Zeros 1 1000000 2 3 4 6 7 For N 1
Add To The Following Code Its Vectorized Version 1 Start Stopwatch Timer Tic A Zeros 1 1000000 2 3 4 6 7 For N 1 (27.57 KiB) Viewed 53 times
.
Add to the following code its vectorized version: 1 % Start stopwatch timer tic A = zeros (1, 1000000); 2 3 4 6 7 for n = 1:1000000 A(n) = nthroot (n.3); end 8 % Read elapsed time from stopwatch toc 9 10 11% insert your code here Use tic and toc functions to measure the performance of your code. Compare it with the performance of the code with for loop (add both times as a comment to the script).