Matlab - Generate square convex function with positive definite Hessian Matrix

458 Views Asked by At

So, I have to generate a square convex function in Matlab and it's Hessian Matrix must be positive definite but I can't find any function that can help me do that.

Is there anything I should search for or I simply think it and insert it from my keyboard?

1

There are 1 best solutions below

1
On

You can do the following:

  • Generate a random symmetric matrix (Matlab: rand)
  • Do an eigenvalue decomposition (Matlab: eig), returning an orthogonal matrix $U$
  • Generate a random, positive vector and put it on the diagonal of $\Sigma$
  • $U^\top \, \Sigma \, U$ is a random, symmetric, positive definite matrix with eigenvectors from $U$ and eigenvalues from $\Sigma$.