Question

5. The time elapsed to execute a function in Matlab can be computed by executing: tic;

function_call; toc. For example, to determine the time it takes sin(pi/6) to execute on

your specific machine, type tic; sin(pi/6); toc at the Matlab prompt and press return.

Depending on which other processes are running in the background, the elapsed time

returned will vary. Run the code 10 times and compute the average elapsed time. Then,

repeat for the user-defined function sin_poly, by executing tic; sin_poly(pi/6); toc. Which

function computes the sine faster? And by how much (in percent)? Explain.

Question image 1