na-lab-gauss seidel

Version 1.0.0 (1.19 KB) by Akshay
code for gauss seidel
1 Download
Updated 15 Nov 2022

View License

a = [4.63 -1.21 3.22 ;-3.07 5.48 2.11 ; 1.26 3.11 4.57;];
b = [2.22 ; -3.17 ; 5.11;];
x = [0;0;0];
n= input("Enter no of iterations :");
for k=1:n
xold = x;
for i=1:size(a,1)
sum = 0;
for j=1:i-1
sum = sum+a(i,j)*x(j);
end
for j=i+1:size(a,1)
sum = sum + a(i,j)*xold(j);
end
x(i)= (1/a(i,i))*(b(i)-sum);
end
end
disp(x)

Cite As

Akshay (2024). na-lab-gauss seidel (https://www.mathworks.com/matlabcentral/fileexchange/120528-na-lab-gauss-seidel), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0