0
votes

I have limited data RV for which I can find the mean mu and standard deviation sigma. Now I want to generate more data points keeping the same mu and sigma. How would I go about doing this in MATLAB? I did the following, however when I plot mean of the generated data (mu_2) it does not match mu...

N = 15
R = mean(RV) + std(RV)*randn(N, 1);
mu = mean(RV)*ones(N,1);
mu_2 = mean(R)*ones(N,1);
3

3 Answers

1
votes

That looks correct. For such a small sample size, it's unlikely that you'll get a very good match. Try a much bigger value of N.

If you want to force your dataset to a particular mean and stddev, then you could just generate a set of samples, then measure their mean and stddev, and then just adjust by scaling and scalar addition.

For example:

R = randn(N,1);

% Measure
mu_tmp = mean(R);
std_tmp = std(R);

% Normalise and denormalise
R = (R - mu_tmp) / std_tmp;
R = (R * std_desired) + mu_desired;
3
votes

I think you should use normrnd(mu,sigma) function go to documentation to get more details

Best regards

0
votes

You can also generate Gaussian mixtures using the Netlab library (its free!)

mix=gmm(8,3,'spherical');
[Data, Label]=gmmsamp(mix,1000);

The above generates a data set with 8 dimensions and three centers (spherical) over 1000 observations.