MATLAB Answers

How can I create sparse symmetric positive definite linear system?

57 views (last 30 days)
D
D on 6 Aug 2013
Commented: sai chand on 17 Jul 2019
Dear All :) I'm looking for sparse symmetric positive definite linear system Ax=b. Is it possible to generate it in Matlab? I need matrix A about 50x50 (maximum 100x100 - minimum 20x20) and vector b. It might be floating point numbers... I prefer not compressed format ;)
Thank you in advance.
D.

  0 Comments

Sign in to comment.

Accepted Answer

Richard Brown
Richard Brown on 6 Aug 2013
Edited: Richard Brown on 6 Aug 2013
sprandsym is what you want.
m = 50;
density = 2/m; % for example
rc = 0.1; % Reciprocal condition number
A = sprandsym(m, density, rc, 1);
If you don't want it in compressed column format
A = full(A);
Verify positive definiteness
chol(A);

  4 Comments

Show 1 older comment
Richard Brown
Richard Brown on 7 Aug 2013
Not directly, but you might try scaling and rounding results from sprandsym, or something like that
sai chand
sai chand on 17 Jul 2019
How to generate the matrix b.
Can it be a random one independent of the way A is generated?
sai chand
sai chand on 17 Jul 2019
I needed to generate a symmetric sparse positive definite matrix. can you help me in that?

Sign in to comment.

More Answers (0)


Translated by