How can I create sparse symmetric positive definite linear system?

8 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Richard Brown
Richard Brown il 6 Ago 2013
Modificato: Richard Brown il 6 Ago 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 Commenti
sai chand
sai chand il 17 Lug 2019
How to generate the matrix b.
Can it be a random one independent of the way A is generated?
sai chand
sai chand il 17 Lug 2019
I needed to generate a symmetric sparse positive definite matrix. can you help me in that?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Sparse Matrices in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by