Calculate the time taken to compute sum of 1/k^3 from 1 -> 1000 using both loops and vectorised commands using tic toc.
The Attempt at a Solution
n = 1e3; % number of terms in the sum
s = 1; % accumulator variable (for the sum)
for k = 2:n
s = s + 1/k^3;
s; % print value of variable s
k = 1:1000;
y = 1./k.^3;
Am I using tic toc in the correct way? If not, how should they be used and if I run this code will the time be displayed in the command window?