By Baraa Mohandes
This function generates random values, for multiple correlated variables but with different distributions
var = MultiVarRand(distribs,rho,n,yes_plot)
distribs: a cell-vector describing the distribution of each variable.
each variable is represented by one cell in the vector
inside this one cell, are the descriptors of the distribution
first element in the cell must be the NAME of the distribution, from the list of MATLAB accepted distributions
all remaining elements in the cell are parameters of the distribution
each cell describing one variable's distribution, must be a number of cells (because the name of distribution is a character string)
Example:
distribs ={
{'beta',15,25}; % first variable has a beta distribution with parameters 15, 25
{'rayl',2}; % second variable has a rayleigh distribution with parameter 2
{'wbl',5,10}; % third variable has a weibull distribution with parameters 5, 10
{'norm',5,0.2}; % fourth variable has a normal distribution with parameters 5, 0.2
};
rho: The covariance matrix between the variables. invalid matrices will return an error
A numerical array of 3 columns, of the form: [index of first variable, index of second variable, correlation factor]
Example:
rho = [
1 2 .81
3 1 -0.5
3 2 -0.6
];
Variables 1 and 2 have a correlation factor of 0.81
Variables 1 and 3 have a correlation factor of -0.6
Variable 4 has no correlation with any other variables
n: Number of samples. a scalar
yes_plot: Logical argument. ture = produce demonstrative plots of data, and print the list of correlation factors
Example:
distribs ={
{'beta',15,25};
{'rayl',2};
{'wbl',5,10};
};
rho = [
1 2 .81
3 1 -0.5
3 2 -0.6
];
n=5000;
MultiVarRand(distribs,rho,n,true);
인용 양식
Ba Mo (2024). MultiVarRand (https://www.mathworks.com/matlabcentral/fileexchange/71557-multivarrand), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- AI, Data Science, and Statistics > Statistics and Machine Learning Toolbox > Probability Distributions > Discrete Distributions > Geometric Distribution >
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.0.0 |