Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views6 pages

Matlab Final Report

This document analyzes a MATLAB code that implements the Gauss-Seidel iterative method to solve systems of linear equations. The code introduces a relaxation parameter (omega) that controls the convergence rate. Experimenting with different omega values, the summary found that values too small or large reduce convergence speed or cause instability, and the optimal omega depends on the system's characteristics.

Uploaded by

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

Matlab Final Report

This document analyzes a MATLAB code that implements the Gauss-Seidel iterative method to solve systems of linear equations. The code introduces a relaxation parameter (omega) that controls the convergence rate. Experimenting with different omega values, the summary found that values too small or large reduce convergence speed or cause instability, and the optimal omega depends on the system's characteristics.

Uploaded by

kiranzehra389
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Analyzing the Gauss-Seidel Iterative Method with

Relaxation Parameter Implementation

Abstract:

This lab report presents an analysis of the MATLAB code implementing the Gauss-Seidel
iterative method with a relaxation parameter. The code is designed to solve a system of linear
equations represented by the coefficient matrix (A) and the right-hand side vector (b). The
relaxation parameter (omega) is introduced to control the convergence behavior of the iterative
method. The report explores the functionality of the code and discusses its performance in terms
of convergence and adaptability.

1. Introduction:

The Gauss-Seidel iterative method is a powerful numerical technique for solving linear systems of
equations. The introduction of a relaxation parameter allows for flexibility in controlling the
convergence rate, which is crucial for adapting the method to various scenarios.

2. Code:
Code Description:
1. Input Parameters:

The code takes the coefficient matrix (A), right-hand side vector (b), relaxation
parameter (omega), convergence tolerance, and maximum number of iterations as input
parameters.

2. Iterative Process:

The Gauss-Seidel iteration is implemented within a loop that runs for a specified
maximum number of iterations. The code uses vectorized operations to update the solution vector
(x) based on the relaxation parameter and the system of equations.

3. Convergence Check:

The code includes a convergence check using the infinity norm. If the difference between
consecutive iterations falls below the specified tolerance, the code terminates, indicating
convergence.

Input:
Explanation:

1. Coefficient Matrix (A) and Right-Hand Side Vector (b):

The matrix A represents the coefficient matrix of the system of linear equations.
The vector b represents the right-hand side vector of the system.

2. Relaxation Parameter (omega):

The variable omega is set to 1.2. This value can be adjusted to experiment with different levels of
relaxation. Different values of omega may affect the convergence speed and stability of the
iterative method.

3. Convergence Tolerance and Maximum Iterations:

The variable tolerance is set to 1e-6, representing the desired convergence tolerance. The iteration
will stop when the difference between consecutive iterations falls below this threshold.
The variable max_iterations is set to 1000, specifying the maximum number of iterations before
the algorithm stops, even if convergence is not achieved.

4. Calling the Gauss-Seidel Function:

The function gauss_seidel_relaxation is called with the input parameters A, b, omega, tolerance,
and max_iterations.
The function returns the solution vector x or issues a warning if convergence is not achieved
within the specified maximum iterations.

5.Displaying the Solution:

The solution vector x is displayed using disp('Solution:'); disp(x);. This shows the results obtained
from the Gauss-Seidel iterative method with the specified parameters.
 Output (omega=1.2)

when omega is 1.2 then value of x converged in 11 iteration.

 Output (omega=1.5)
when omega is 1.5 then value of x converged in 23 iteration.
Output (omega=1.7)
when omega is 1.7 then value of x converged in 42 iteration.

 Output (omega=1.8)
when omega is 1.8 then value of x converged in 66 iteration.
Explaination:
 When you experiment with different values of omega, you are essentially adjusting the rate at
which the iterative method updates the solution vector in each iteration. The optimal value of
omega depends on the specific characteristics of the linear system being solved.

 If omega is too small (close to 0): The method may converge very slowly or may not
converge at all. This is because the iterative updates are too small, and the method struggles
to make progress towards the solution.

 If omega is too large: The method may become unstable, and the solution vector may
oscillate or diverge. This is because the updates are too aggressive, and the method
overshoots the solution.

 The optimal value of omega: It lies somewhere between these extremes. The choice of an
appropriate omega depends on the spectral radius of the iteration matrix derived from the
system of equations. The optimal omega balances the trade-off between convergence speed
and stability.

Conclusion:

In conclusion, the analysis of the Gauss-Seidel iterative method with a relaxation parameter
reveals the sensitivity of the convergence behavior to the chosen value of omega. The code
effectively solves linear systems of equations and incorporates a convergence check based on
the specified tolerance.
Through experimentation with different values of omega, it becomes evident that the
convergence rate varies significantly. A careful selection of omega is essential to strike a
balance between convergence speed and stability.

In the presented examples:

 For omega = 1.2, the solution converged in 11 iterations.

 For omega = 1.5, the solution converged in 23 iterations.

 For omega = 1.7, the solution converged in 42 iterations.

 For omega = 1.8, the solution converged in 66 iterations.

These results highlight the need for a thoughtful choice of the relaxation parameter to optimize the
performance of the Gauss-Seidel method for a specific linear system. Additionally, the iterative
nature of the method allows users to observe how the solution evolves across iterations, providing
insights into the convergence process.

You might also like