Normrnd of matrix

  • Follow


Is it possible to use Normrnd to generate random numbers from a preexisting matrix maintaining the sigma and mu values wanted.

ex. A=[1 2 3 4 5 ] 
normrndA=[another 1X5 matrix with mean of 1 and SD of .5]=C
and I want to say B=normrnd[C with mean of 1 and SD of .5]

So, far I cannot get Normrnd to accept the mean and standard deviation for a specific matrix .

Any ideas or suggestions about whether this can be done will be appreciated. Thanks!
0
Reply Shernita 3/4/2010 7:22:23 PM

Shernita wrote:
> Is it possible to use Normrnd to generate random numbers from a 
> preexisting matrix maintaining the sigma and mu values wanted.
> 
> ex. A=[1 2 3 4 5 ] normrndA=[another 1X5 matrix with mean of 1 and SD of 
> .5]=C
> and I want to say B=normrnd[C with mean of 1 and SD of .5]

I cannot figure out what you are asking about the preexisting matrix.


> So, far I cannot get Normrnd to accept the mean and standard deviation 
> for a specific matrix .

Multiply the result of Normrnd by the desired standard deviation and add the 
desired mean to that.
0
Reply Walter 3/4/2010 7:32:07 PM


Walter Roberson <roberson@hushmail.com> wrote in message <hmp2eb$ppo$1@canopus.cc.umanitoba.ca>...
> Shernita wrote:
> > Is it possible to use Normrnd to generate random numbers from a 
> > preexisting matrix maintaining the sigma and mu values wanted.
> > 
> > ex. A=[1 2 3 4 5 ] normrndA=[another 1X5 matrix with mean of 1 and SD of 
> > .5]=C
> > and I want to say B=normrnd[C with mean of 1 and SD of .5]
> 
> I cannot figure out what you are asking about the preexisting matrix.
> 
> 
> > So, far I cannot get Normrnd to accept the mean and standard deviation 
> > for a specific matrix .
> 
> Multiply the result of Normrnd by the desired standard deviation and add the 
> desired mean to that.


I want to use another already defined matrix to generate the random numbers of a new matrix and define it with the same mean and standard deviation.
0
Reply Shernita 3/4/2010 7:48:22 PM

Shernita wrote:

> I want to use another already defined matrix to generate the random 
> numbers of a new matrix and define it with the same mean and standard 
> deviation.

Do you mean that you new matrix should contain samples randomly selected from 
the existing matrix? If so, then unless you allow for a tolerance on the mean 
and standard deviation, you have a "knapsack problem", which is NP-complete 
(that is, there are known algorithms for it, but it takes time that is 
exponential in the matrix size); and if the matrix to be generated is smaller 
than the existing matrix, there might not be any solution at all (and if the 
matrix to be generated is the same size as the existing matrix, the only 
solutions might be those which are permutations of the existing matrix.)
0
Reply Walter 3/4/2010 8:06:30 PM

On 3/4/2010 2:22 PM, Shernita wrote:
> Is it possible to use Normrnd to generate random numbers from a
> preexisting matrix maintaining the sigma and mu values wanted.
>
> ex. A=[1 2 3 4 5 ] normrndA=[another 1X5 matrix with mean of 1 and SD of
> .5]=C
> and I want to say B=normrnd[C with mean of 1 and SD of .5]

NORMRND will accept matrices for the mean and std dev arguments, but the purpose is to be able to generate an output matrix each of whose elements has a different mean and std dev.  I don't think that's what you are trying to do.

If you want a matrix all of whose elements are drawn from the same distribution, then you need to pass in scalars for the mean and std dev.  Your example code doesn't provide an A whose overall mean and std dev are 1 and .5, so it's rather difficult to give advice.  But it may be that the scalars you are looking for are mean(A(:)) and std(A(:)).
0
Reply Peter 3/4/2010 8:18:47 PM

4 Replies
444 Views

(page loaded in 0.006 seconds)

Similiar Articles:







7/29/2012 11:06:30 PM


Reply: