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 (2026). 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
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
