Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using MATLAB, write scripts to calculate how long it takes to do each of the following ten million (i.e., 10^7) times. You may do the
Using MATLAB, write scripts to calculate how long it takes to do each of the following ten million (i.e., 10^7) times. You may do the test a few times in a row and choose the lowest value, so that you can eliminate any issues with your programming environment having to load other libraries, etc.
NOTE: Use the timing features of MATLAB (e.g., 'tic' and 'toc' in MATLAB). It is not acceptable to stopwatch this manually!
Please help and thank you!
How long (in seconds) does it take your code to set two variables to random numbers between one (1) and two (2)? It must generate a new random number for each variable each time. How long (in seconds) does it take your code to set two variables to random numbers between one (1) and two (2) and to multiply them together (storing into a third variable name)? It must generate a new random number for each variable each time. How long (in seconds) does it take your code to set two variables to random numbers between one (1) and two (2) and to divide the first by the second (storing into a third variable name)? It must generate a new random number for each variable each time. How long (in seconds) does it take your code to set two variables to random numbers between one (1) and two (2) and to take the sine of one of them (storing into a third variable name)? We won't do anything with the second random number this time around (it's just for consistency in the timing comparison). Your code must generate a new random number for each variable each timeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started