MultiVarRand

Version 1.0.0 (3,21 KB) von Ba Mo
This function generates random values, for multiple correlated variables but with different distributions
32 Downloads
Aktualisiert 16 Mai 2019

Lizenz anzeigen

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);

Zitieren als

Ba Mo (2024). MultiVarRand (https://www.mathworks.com/matlabcentral/fileexchange/71557-multivarrand), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R2018a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0