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
.
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).
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).