Project 1 Solutions

# Project 1 Solutions - PROJECT#1 Team Name The Unknowns...

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

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: PROJECT #1 Team Name: The Unknowns Members: Hristian Divya Sofia Annon #1 function B=badgauss(A) m=size(A,1); B=A; for i=1:m-1 for j=i+1:m a= -B(j,i)/B(i,i); B(j,:)= a*B(i,:)+B(j,:); end end MATLAB .... >> A=rand(5) A = 0.9501 0.7621 0.6154 0.4057 0.0579 0.2311 0.4565 0.7919 0.9355 0.3529 0.6068 0.0185 0.9218 0.9169 0.8132 0.4860 0.8214 0.7382 0.4103 0.0099 0.8913 0.4447 0.1763 0.8936 0.1389 >> B=badgauss(A) B = 0.9501 0.7621 0.6154 0.4057 0.0579 0 0.2711 0.6422 0.8368 0.3388 0 0 1.6381 2.1032 1.3614-0.0000 0 0 -0.3603 -0.0612-0.0000 0 -0.0000 0 0.0468 _________________________________________________________________________________________________ #2 function x=backsub(A,b) n=size(A,2); x=zeros(n,1); for i=n:-1:1 x(i)= (b(i)-A(i,:)*x)/A(i,i); end MATLAB .... >> A=triu(rand(5)) A = 0.2028 0.0153 0.4186 0.8381 0.5028 0 0.7468 0.8462 0.0196 0.7095 0 0 0.5252 0.6813 0.4289 0 0 0 0.3795 0.3046 0 0 0 0 0.1897 >> b=rand(5,1) b = 0.1934 0.6822 0.3028 0.5417 0.1509 >> x=backsub(A,b) x =-2.1193 1.3796-1.0965 0.7888 0.7955 >> A\b ans =-2.1193 1.3796-1.0965 0.7888 0.7955 ________________________________________________________________________________________________...
View Full Document

{[ snackBarMessage ]}

### Page1 / 9

Project 1 Solutions - PROJECT#1 Team Name The Unknowns...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online