Question: Part A . 5 marks We wish to compute a row vector of n = 1 0 0 0 0 0 0 entries, where entry
Part A marks
We wish to compute a row vector of n entries, where entry I of the vector equals n sin ipin We apply the following approaches:
A: The vector u is created using a forloop without preinitializing the array.
A: The vector v is created using a forloop and it is first preinitialized using Matlabs zeros command.
A: The vector w is created without using a loop.
Use Matlabs tic and toc to measure the time required for each approach. Include the preinitialization for vector v Determine which method is the most efficient and which method is least efficient. Is there a significant difference in the compute time?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
