Untitled3 - end end x(n)=b(n)/a(n,n); A_inv(n,m)=x(n); A...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
clc clear all a=[]; n=length(a); A_inv=zeros(n,n); for m=1:n a=[-1 3 2;1 -2 1;1 -1 1]; b=[0; 0; 0]; b(m)=1; for k=1:n-1 for i=k+1:n; factor=a(i,k)/a(k,k); for j=k+1:n a(i,j)=a(i,j)-factor*a(k,j); end b(i)=b(i)-factor*b(k);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end end x(n)=b(n)/a(n,n); A_inv(n,m)=x(n); A for i=n-1:-1:1 sum=0; for j=i+1:n sum=sum+a(i,j)*x(j); end x(i)=1/a(i,i)*(b(i)-sum); A_inv(i,m)=x(i); end e end disp(A_inv) disp(b)...
View Full Document

This note was uploaded on 02/03/2010 for the course BME 3201 taught by Professor T during the Spring '10 term at Union University TN.

Ask a homework question - tutors are online