MATLAB: What is an appropriate Data Structure for a Matrix with Random Variable Entries?

Posted by user12707 on Programmers See other posts from Programmers or by user12707
Published on 2011-01-08T19:09:32Z Indexed on 2011/01/08 20:00 UTC
Read the original article Hit count: 149

Filed under:

I'm working in an area that is related to simulation and trying to design a data structure that can include random variables within matrices. I am currently coding in MATLAB. To motivate this let me say I have the following matrix:

[a b; 
 c d]

I want to find a data structure that will allow for a, b, c, d to be either real numbers or random variables. As an example, let's say that a = 1, b = -1, c = 2 but let d be a normally distributed random variable with mean 20 and SD 40.

The data structure that I have in mind will give no value to d. However, I also want to be able to design a function that can take in the structure, simulate an uniform(0,1), obtain a value for d using an inverse CDF and then spit out an actual matrix.

I have several ideas to do this (all related to the MATLAB icdf function) but would like to know how more experienced programmers would do it. In this application, it's important that the structure is as "lean" as possible since I will be working with very very large matrices and memory will be an issue.

© Programmers or respective owner

MATLAB: What is an appropriate Data Structure for a Matrix with Random Variable Entries?

Posted by user568249 on Stack Overflow See other posts from Stack Overflow or by user568249
Published on 2011-01-08T19:16:05Z Indexed on 2011/01/08 23:53 UTC
Read the original article Hit count: 148

I'm currently working in an area that is related to simulation and trying to design a data structure that can include random variables within matrices. To motivate this let me say I have the following matrix:

[a b; c d]

I want to find a data structure that will allow for a, b, c, d to either be real numbers or random variables. As an example, let's say that a = 1, b = -1, c = 2 but let d be a normally distributed random variable with mean 0 and SD 1.

The data structure that I have in mind will give no value to d. However, I also want to be able to design a function that can take in the structure, simulate an uniform(0,1), obtain a value for d using an inverse CDF and then spit out an actual matrix.

I have several ideas to do this (all related to the MATLAB icdf function) but would like to know how more experienced programmers would do this. In this application, it's important that the structure is as "lean" as possible since I will be working with very very large matrices and memory will be an issue.

© Stack Overflow or respective owner

Related posts about data-structures