In Matlab, I need to create a symmetric matrix with a given sparsity pattern and whose condition number is low ($\leq 10$). The matrix is sparse (more than half of its entries are zero).

From what I already know, generally if diagonal entries are larger and if the value of the entries are taken from a function, the condition number will be low.


As an example of structure, we can consider Jacobian matrices or matrices whose graph is a star.

  • $\begingroup$ The identity matrix fullfills your conditions. You need to be more precise. $\endgroup$ – nicomezi Aug 14 '18 at 6:35
  • $\begingroup$ @nicomezi it has not the specified structure. $\endgroup$ – M a m a D Aug 14 '18 at 6:36
  • $\begingroup$ Well, more then half of the entries are zero, diagonal entries are larger then nondiagonal and those are taken by the null function. That is why I am asking you to be more precise. $\endgroup$ – nicomezi Aug 14 '18 at 6:38
  • $\begingroup$ @nicomezi I updated the question $\endgroup$ – M a m a D Aug 14 '18 at 6:40
  • $\begingroup$ @RodrigodeAzevedo the value of non-zero entries are random (random for top triangle, the same will be used for bottom triangle) $\endgroup$ – M a m a D Aug 15 '18 at 10:08

Is there a reason you are not using sprandsym(n,density,rc) with density$\geq 0.5$ and rc$\in (0.1,\infty)$ (documentation)?

  • $\begingroup$ I don't know what that is!!! $\endgroup$ – M a m a D Aug 15 '18 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.