{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3sol

# hw3sol - %Let's define the right hand side vector b...

This preview shows pages 1–18. Sign up to view the full content.

Problem 1 Matlab Code %Let's define a square matrix A=[10 2 -1; -3 -6 2; 1 1 5] %Determinant of A detA = det(A) %Inverse of A invA = inv(A) %Let's see if invA is really the inverse of A I1 = A*inv(A) I2 = inv(A)*A Output A = 10 2 -1 -3 -6 2 1 1 5 detA = -289 invA = 0.1107 0.0381 0.0069 -0.0588 -0.1765 0.0588 -0.0104 0.0277 0.1869 I1 = 1.0000 0.0000 0 0.0000 1.0000 0.0000 -0.0000 0.0000 1.0000

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
I2 = 1.0000 0.0000 0.0000 -0.0000 1.0000 0.0000 0 0 1.0000

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem 2 Matlab Code: A = [-cos(pi/6) 0 cos(pi/3) 0 0 0; -sin(pi/6) 0 -sin(pi/3) 0 0 0; cos(pi/6) 1 0 1 0 0; sin(pi/6) 0 0 0 1 0; 0 -1 -cos(pi/3) 0 0 0; 0 0 sin(pi/3) 0 0 1]; b = [0; 1000; 0; 0; 0; 0]; forces = A\b Output forces = -500.0000 433.0127 -866.0254 0 250.0000 750.0000

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
%Let's define the coefficient matrix A A=[-6 0 1 0 0; 3 -3 0 0 0; 0 1 -9 0 0; 0 1 8 -11 2; 3 1 0 0 -4]; c01=10;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %Let's define the right hand side vector b b=[-5*c01; 0; -160; 0; 0]; [L,U]=lu(A); z = L\b; c = U\z %part 2 of the problem c01=1:20; for i=c01 b=[-5*c01(i); 0; -160; 0; 0]; z = L\b; c = U\z; c2(i) = c(2); end plot(c01,c2);grid on 2 4 6 8 10 12 14 16 18 20 2 4 6 8 10 12 14 16 18 20 %problem 5 - Newton's method clear all ; ITERMAX = 2; Tol = 1e-4; % give the initial guess x = [0.75;0.75]; %note I use x(1)=x & x(2) = y iter = 0; while (1) xold = x; %define the Jacobian matrix & right hand side A = [1-x(2) -x(1);x(2) -1+x(1)]; b = -[(x(1)-x(1)*x(2)); (-x(2) +x(1)*x(2))]; %solve the system delx = A\b; iter = iter + 1; disp([ 'Iter : ' num2str(iter)]); %new root x = xold + delx %RE re = abs((x - xold)./x); if ((max(re) < Tol) | (iter == ITERMAX)) break ; end end OUPUT: Iter : 1 x = 1.1250 1.1250 Iter : 2 x = 1.0125 1.0125...
View Full Document

{[ snackBarMessage ]}

### 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