0% found this document useful (0 votes)
50 views1 page

Gauss-Seidal Method Program Output

This document contains a MATLAB program to solve a system of equations using the Gauss-Seidel method. It asks the user to input the functions fx, fy, and fz that define the system, and the number of iterations n. It then runs n iterations of the Gauss-Seidel method, printing the current values of x, y, and z at each iteration.

Uploaded by

Akshay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views1 page

Gauss-Seidal Method Program Output

This document contains a MATLAB program to solve a system of equations using the Gauss-Seidel method. It asks the user to input the functions fx, fy, and fz that define the system, and the number of iterations n. It then runs n iterations of the Gauss-Seidel method, printing the current values of x, y, and z at each iteration.

Uploaded by

Akshay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name: AKSHAY ZOMAN

Roll No:69 Batch: T8

% PROGRAM FOR GAUSS SEIDAL METHOD


clc;
clear all;
close all;
fx=input(' Enter function fx(y,z)=');
fy=input('Enter function fy(x,z)=');
fz=input('Enter function fz(x,y)=');
n=input('Enter the number of iteration n=')
x=0;
y=0;
z=0;
fprintf('\n\n>> Solution by programme:\n');
for i=1:n
x=fx(y,z);
y=fy(x,z);
z=fz(x,y);
fprintf('\n x= %f',x);
fprintf('\n y= %f',y);
fprintf('\n z= %f',z);
end;

OUTPUT
Enter function fx(y,z)=@(y,z)((5-y-z)/4)
Enter function fy(x,z)=@(x,z)((19-x-2*z)/6)
Enter function fz(x,y)=@(x,y)((10+x+2*y)/-5)
Enter the number of iteration n=5
n=
5
>> Solution by programme:
x= 1.250000 y= 2.958333 z= -3.433333
x= 1.368750 y= 4.082986 z= -3.906944
x= 1.205990 y= 4.267983 z= -3.948391
x= 1.170100 y= 4.287780 z= -3.949132
x= 1.165338 y= 4.288821 z= -3.948596
>>

You might also like