comparison between gaussian elimination and cholesky decomposition method
17 views (last 30 days)
Show older comments
Please how do I write a matlab programming code to compare gaussian elimination and cholesky decomposition method
0 Comments
Answers (1)
Vidhi Agarwal
on 16 Jun 2023
The below code is comparison between Gaussian Elimination method and cholesky Decomposition method
You Can learn this methods from following refernces.
Gaussian elimination is a direct and a simple method that involves transforming a linear system of equations into an upper triangular matrix using row operations. Gaussian elimination is usually used in larger problems, where it can be more efficient than iterative methods.
Cholesky decomposition, on the other hand, is a method specifically for symmetric positive definite matrices (A symmetric positive definite matrix is a square matrix where the entries are symmetric and every eigenvalue of the matrix is positive). It involves factoring the matrix into the product of a lower triangular matrix and its conjugate transpose, i.e., A = L*L', where L is a lower triangular matrix.
The Cholesky factorization is often preferred over Gaussian elimination for solving linear systems with symmetric positive definite matrices, as it is more efficient due to the structure of the problem. It involves fewer calculations and uses the property that the matrix is symmetric, resulting in a faster solution.
In this following piece of code we found solution of a matrix using 2 methods, cholesky decomposition and gaussian elimination.
%choosing a definite matrix
A = [5 2 1; 2 9 3; 1 3 7];
b = [1; 2; 3];
% Use the chol function to compute the Cholesky decomposition of A and by lower
% paramter we are trying to find lower triangular matrix
L = chol(A,'lower');
% Use back substitution to solve the system of linear equations
y = L \ b;
x = L' \ y;
% Display the solution vector x
disp(x);
%gaussian elimination
%Ax = b
A = [5 2 1; 2 9 3; 1 3 7];
b = [1; 2; 3];
% Use the backslash operator to solve the system of linear equations
x = A \ b;
% Display the solution vector x
disp(x);
0 Comments
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!