[Solved]Activity 4 Used Tic Toc Commands Time Long Takes Solve Ax B Using Backslash N 1000 1500 20 Q37300135
Please answer using MATLAB code!!


In Activity 4, we used the tic and toc commands to time how long it takes to solve Ax = b using backslash with n 1000, 1500. 2000. 2500, 3000, 3500, and 4000 equations. The matrix A and vector b were random matrices created using the commands A = rand (n) and b = rand (n, 1), respectively. We plotted the time versus n on a log-log scale. Re-create the plot from the activity which should look somewhat like the plot below. 0 0 10 1000 2000 2500 3000 3500 4000 The points should be blue circles. Then time how long it takes to solve Ax – b (for the same matrices A and the same vectors b) using LU decomposition. Plot the points solve Ax- b (for the same matrices A and the same vectors b) using inv (A). Plot the points as green squares on the same axes as the other two methods Add lines to your plot the represent O(n2) and O(n3). The colors of the lines should be cyan and magenta, respectively. Adjust the lines so they are “near” your points and you can easily compare the trends of the points with the slopes of the lines. it Include the plot with your writeup. Then comment on how the speed of each of the three methods compare with each other. Give a rough estimate of the order of each by comparing with the O(n2) and O(n3) lines. Show transcribed image text In Activity 4, we used the tic and toc commands to time how long it takes to solve Ax = b using backslash with n 1000, 1500. 2000. 2500, 3000, 3500, and 4000 equations. The matrix A and vector b were random matrices created using the commands A = rand (n) and b = rand (n, 1), respectively. We plotted the time versus n on a log-log scale. Re-create the plot from the activity which should look somewhat like the plot below. 0 0 10 1000 2000 2500 3000 3500 4000 The points should be blue circles. Then time how long it takes to solve Ax – b (for the same matrices A and the same vectors b) using LU decomposition. Plot the points
solve Ax- b (for the same matrices A and the same vectors b) using inv (A). Plot the points as green squares on the same axes as the other two methods Add lines to your plot the represent O(n2) and O(n3). The colors of the lines should be cyan and magenta, respectively. Adjust the lines so they are “near” your points and you can easily compare the trends of the points with the slopes of the lines. it Include the plot with your writeup. Then comment on how the speed of each of the three methods compare with each other. Give a rough estimate of the order of each by comparing with the O(n2) and O(n3) lines.
Expert Answer
Answer to In Activity 4, we used the tic and toc commands to time how long it takes to solve Ax = b using backslash with n 1000, 1… . . .
OR

