Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4) In Matlab, generate a square matrix [A] of random numbers having n rows, for n = 100, 200, 500, 1000, 2000, 5000 and 10,000.
4) In Matlab, generate a square matrix [A] of random numbers having n rows, for n = 100, 200, 500, 1000, 2000, 5000 and 10,000. (Don't display these!). Also generate a random column matrix (i.e., n by 1) {b} of random numbers. (Don't display!) Solve the corresponding system of equations([A]{x)=(b)) for {x). (Don't display the results!) Use the tic and toc functions in Matlab to record the computation time for solving the system in each case. For each n perform the calculation 10 times to obtain the average computation time. Plot the average time as a function of n, using a log-log plot. Comment on the overall trend. HINT: n= 1000; A = rand(n): b = rand(n, 1); to-tic; x = Alb; tval = toc(to)
Step 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