Version 1.0.2 (3.18 KB) by Burke Rosen
Find the nearest Positive Semi-Definite matrix to an arbitrary real or complex square matrix.


Updated 20 Dec 2019

View License

This functions returns the nearest (minimizing the Frobenius norm of the difference) symmetric and positive definite matrix to a supplied square matrix which can be real or complex. It is particularly useful for ensuring that estimated covariance or cross-spectral matrices have the expected properties of these classes.

By default, it uses the method of Nicholas Highgam:
Higham NJ. Computing a nearest symmetric positive semidefinite matrix.
Linear algebra and its applications. 1988 May 1;103:103-18.

This function was modified from nearestSPD.m by John D'Errico

Most importantly I added support for complex matrices, which must be Hermitian rather than symmetric.
I also added the 'eig' method and made other small changes.

Cite As

Burke Rosen (2023). nearestPSD (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Linear Algebra in Help Center and MATLAB Answers

Inspired by: nearestSPD

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

fixed abbreviations.


updated Summary.