Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem #1. Set n 200 and generate an n n matrix and two vectors in Rn (all having integer entries) via the following commands A

image text in transcribed

Problem #1. Set n 200 and generate an n n matrix and two vectors in Rn (all having integer entries) via the following commands A = floor (10*rand(n)); b = sum(A,2); z = ones (n ,1); Since this matrix and these vectors are large, you want semicolons here to suppress the output. (a) The exact solution to Ax -b should be the vector z. Explain why. You can solve the linear system in MATLAB via either the backslash operation or by forming A-1b. What is the difference? Write a script to both time and compute the errors for each approach.1 Include the commands above and use tic toc as follows. tic; x = A\b; t1 = toc ; err1 max (abs (x-z)); disp(['time for backslash solve: ',num2str(t1)]) disp(['error for backslash solve: ',num2str(erri)]) tic; y inv (A) *b; t2 toc ; err2 = max (abs (y-z)); disp(['time for inverse A solve: ',num2str (t2)1) disp(['error for inverse A solve: ',num2str (err2)]) Which is faster and which has better error? Can you explain the results? (b) Repeat using n = 500 and n = 1000. Include your script, the output of your script, and comments on what you observe

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

Describe the three-step process for estimating WACC.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago

Question

2. Place a value on the outcomes.

Answered: 1 week ago