Create a matrix with a specific correlation within a specific distribution

1 次查看(过去 30 天)
I am creating matrices of random variables within the normal, uniform, and chi square distributions. However, I need to be able to specify the correlation value of the matrices.
rowsize = 10;
columnsize = 3;
dg = 2;
correlation_value = 0.7;
matrix = zeros(rowsize, columnsize);
for row = 1:rowsize
for column = 1:columnsize
matrix(row, column) = chi2rnd(dg);
end
end
correlatedMatrix = SomeFunction(matrix, correlation_value);
result = corr(correlatedMatrix)
result =
1.0000 0.7000 0.7000
0.7000 1.0000 0.7000
0.7000 0.7000 1.0000
Is there a function or some code to replace
correlatedMatrix = SomeFunction(...)
or a function or code to replace the call to chi2rnd(dg) where result will still be within the chi square distribution?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by