You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
The function first constructs two(2) signed {-1, +1} Bernoulli variables Y_1, Y_2 such that p(Y_1 = -1) = p1, p(Y_2 = -1) = p2, and E[Y_1Y_2] = r. Constraints: 0 < p1,p2 < 1, -1 < r < 1. Next, it draws N realizations of the two variables in Y(m,:), m = 1,2. The sample pdf and cross correlation converge as N -> infinity (obviously).
Example: generate N realizations of variables with mean 0, variance 1, and correlation 0.3: Y = signed_bernoulli2(N,0.5,0.5,0.3).
Cite As
Aravindh Krishnamoorthy (2026). signed_bernoulli2(N,p1,p2,r) (https://www.mathworks.com/matlabcentral/fileexchange/65164-signed_bernoulli2-n-p1-p2-r), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.0.0 (2.69 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 |
