.
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
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Add to the following code its vectorized version: 1 % Start stopwatch timer tic A = zeros (1, 1000000); 2 3 4 6 7 for n
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!