Sample a truncated multivariate normal distribution
Version 1.0.0 (1.56 KB) by
Yavor Kamer
Generates samples from a MVN within a lower and upper bound.
There exist many implementations on FEX solving the same problem, I wasn't very confident in using them as they sometimes failed to converge (using fsolve etc) or would generate warnings complaining about the covariance matrix being close to singular.
This is a simple brute-force method that records the accepted samples, adjusts the trial size and repeats until it has reached the target sample number.
Cite As
Yavor Kamer (2026). Sample a truncated multivariate normal distribution (https://www.mathworks.com/matlabcentral/fileexchange/69201-sample-a-truncated-multivariate-normal-distribution), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2015b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Numerical Integration and Differential Equations in Help Center and MATLAB Answers
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |