# Lab2 - MAT 343 MATLAB ASSIGNMENT#2 Problem 1(a(i n = 1000 A...

• Lab Report
• 4
• 100% (10) 10 out of 10 people found this document helpful

This preview shows page 1 - 2 out of 4 pages.

%% MAT 343 MATLAB ASSIGNMENT #2 %% Problem 1 %% % (a) %% % (i) n = 1000; A = floor(10*rand(n)); b = sum(A')'; z = ones(n,1); tic, x = A\b; toc tic, y = inv(A)*b; toc %% % (ii) sum(abs(x-z)) sum(abs(y-z)) %% % (b) n = 2000; A = floor(10*rand(n)); b = sum(A')'; z = ones(n,1); tic, x = A\b; toc tic, y = inv(A)*b; toc sum(abs(x-z)) sum(abs(y-z)) n = 5000; A = floor(10*rand(n)); b = sum(A')'; z = ones(n,1); tic, x = A\b; toc tic, y = inv(A)*b; toc sum(abs(x-z)) sum(abs(y-z)) %% % (c) %% %% Problem 2 n = 100; A = eye(n) - triu(ones(n),1); b = sum(A')'; z = ones(n,1);

Subscribe to view the full document.

x = A\b; y = inv(A)*b; sum(abs(x - z)) sum(abs(y - z)) %% Problem 3 A = floor(10*rand(6)); b = floor(20*rand(6,1))-10; %% % (a) x = A\b %% % (b) U = rref([A,b]) %% % (c) U(:,7) - x format long U(:,7) - x format short %% % (d) A(:,3) = 4*A(:,1)+5*A(:,2) rref([A b])

#### You've reached the end of your free preview.

Want to read all 4 pages?

• Fall '13

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern