Texts: Calculate using Octave and share command script
Question 1
1.1. Using a for statement, write a code that will generate a plot for the function below:
y = cos(x) where -10 ≤ x ≤ 10
(8)
1.1. Evaluate using a for loop:
∑ (n^2 + 1), n = 1 to 10000
(8)
1.1.1. Try vectorizing and computing the runtime. What difference in computational time is achieved?
(8)
1.1.2. Determine the runtime to compute the above.
(4)