Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: mvnrnd output
Date: Sun, 15 Feb 2009 22:56:01 +0000 (UTC)
Organization: University of Wisconsin-Milwaukee
Lines: 51
Message-ID: <gna6i1$qq9$1@fred.mathworks.com>
References: <gna2ma$l6s$1@fred.mathworks.com> <gna51c$k59$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1234738561 27465 172.30.248.37 (15 Feb 2009 22:56:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 15 Feb 2009 22:56:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1489742
Xref: news.mathworks.com comp.soft-sys.matlab:518440

Sorry if my question was not clear - I'm fairly new to all of this, so I appreciate your clarifying questions.

I am using the 'cases' third input argument for mvnrnd - here it is 8 for ease of viewing the output, although it needs to be much higher eventually.  My Sigma is generated by a covariance function, hence the first row and column of Sigma are zero.  

Again my concern is the apparent lack of randomness in my output since each row of mvnrnd data begins with zero.


Here's the basic part of my code:

t=0:.2:1;   %time points
[m,n]=size(t);   
mu=zeros(1,n);  %mean vector (row vector)
[S,T]=meshgrid(t, t);
Sigma=min(S,T)       %Sigma is Wiener covariance matrix based on R(s,t)=min(s,t)
x=mvnrnd(mu,Sigma,8)

And here's the output:

Sigma =
         0         0         0         0         0         0
         0    0.2000    0.2000    0.2000    0.2000    0.2000
         0    0.2000    0.4000    0.4000    0.4000    0.4000
         0    0.2000    0.4000    0.6000    0.6000    0.6000
         0    0.2000    0.4000    0.6000    0.8000    0.8000
         0    0.2000    0.4000    0.6000    0.8000    1.0000

x =
         0   -0.0736    0.2493   -0.1080    0.2456    0.4455
         0    0.1888    0.2057    0.2752    0.7117    0.5520
         0    0.2968   -0.2304   -0.2909   -0.0418    0.0206
         0    0.4921    0.8112    0.5221    0.7661    0.6145
         0    0.4981    0.0464    0.1461   -0.1544   -0.6289
         0   -0.9377   -1.0224   -1.6863   -0.7339   -0.6709
         0   -0.0345    0.2519    0.7153    0.1456    0.2328
         0   -0.2093   -0.4491   -0.8115   -0.2979   -0.1080

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gna51c$k59$1@fred.mathworks.com>...
> "Beth " <brownep@uwm.edu> wrote in message <gna2ma$l6s$1@fred.mathworks.com>...
> > I am trying to generate random data for a simulation using the mvnrnd command.  To start, I'm using mu=zeros(1,n).  I'm trying out a couple of processes to generate an nxn Sigma using covariance functions (Wiener, Brownian Bridge, Ornstein-Uhlenbck).  
> > 
> > The issue: when mu is all zeros and Sigma has patterns of zero as well, I end up with mvnrnd(mu,Sigma,n) generating n rows of data which all start with zero.  If I change mu to ones, for example, my mvnrnd generates n rows of data which all start with one.  There seems to be some connection between the patterns of zeros in my Sigma and the mu values.  This strikes me as working against my attempt to generate random data.
> > 
> > Any thoughts would be appreciated.  
> > Thanks,
> > Beth
> 
>   You haven't given enough information to go on here, Beth.  Are you using the 'cases' third input argument to 'mvnrnd'?  When you say "Sigma has patterns of zero", do you mean all elements of 'Sigma' are zero?  If so, there would be zero variance and all output values would just be the same as 'MU' with no randomness about them.  Your statement "all start with zero" means what exactly?  The first output is exactly zero, its first digit is a 0, what?
> 
>   I think you would do well to give some specific information about your matlab code.  Show some results using 'format long' but only for a (hopefully short) row or two of output.  We can't do anything for you as you have posed the problem?
> 
> Roger Stafford