Prev: MATLAB Student Version, Database Toolbox, SQL Server 2008 Express;
Next: How can I do a polynomial fitting in the image.
From: Shernita on 4 Mar 2010 14:22 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!
From: Walter Roberson on 4 Mar 2010 14:32 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.
From: Shernita on 4 Mar 2010 14:48 Walter Roberson <roberson(a)hushmail.com> wrote in message <hmp2eb$ppo$1(a)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.
From: Walter Roberson on 4 Mar 2010 15:06 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.)
From: Peter Perkins on 4 Mar 2010 15:18
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(:)). |