2.5

2.5 | 2 ratings Rate this file 43 Downloads (last 30 days) File Size: 1.32 KB File ID: #39850

Matlab Code Gaussian Elimination Method

by Muhammad Ammad

 

14 Jan 2013 (Updated 17 Jun 2013)

Source = http://crunchmodo.com/matlab-code-gaussian-elimination-method/

| Watch this File

File Information
Description

avialable at http://crunchmodo.com
http://stylebizz.com/
http://stylegerms.com/
http://designernewz.com/

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
18 Jun 2013 Duane Hanselman

Here is the content of this submission. \ does the same thing faster and better, but a one character operator is not as impressive I guess.

function gauss_elimnation
a = [6 2 8;3 5 2;0 8 2];
b = [26;8;-7];
a(:,length(a)+1)=b
[rows cols]=size(a);
answer=zeros(rows,1);
for i=1:cols
for j=i+1:rows
tmp=a(i,:).*(-a(j,i)/a(i,i));
a(j,:)=tmp+(a(j,:));
end
end
for i=length(1:rows)-(1:rows)+1
if(i<cols-1)
a(i,cols)=a(i,cols)-(sum(a(i,i+1:cols-1)));
end
answer(i)=a(i,cols)/(a(i,i));
a(1:i-1,i)=a(1:i-1,i).*answer(i);
end
disp('Solution = ');
disp(answer)
end

05 Feb 2013 Sean Wang  
Updates
17 Jun 2013

New bugs are found and removed

Contact us