Solves Ax=b using the conjugate gradient method. The matrix A should be symmetric and positive definite.
Usage (examples provided at end of m-file):
x=cgm(A,b);
If the matrix is sparse, it is worth trying:
x=cgm(sparse(A),b);
Cite As
Mark Holmes (2024). cgm(A,b) (https://www.mathworks.com/matlabcentral/fileexchange/56208-cgm-a-b), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2018a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Elementary Math > Polynomials >
Find more on Polynomials in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.