how can I generate the normal distribution with arbitrary mean and variance by gauss?

## 4 Answers

0

If you mean you want to compute the normal probability density function of the normal distribution with a specified mean and standard deviation, you can do this

```
p = pdfn2(2.1, 1.1, 1.5);
proc (1) = pdfn2(x, m, sd);
retp(pdfn((x-m)./sd)./sd);
endp;
```

0

You know, I want to produce data which have the normal distribution with specified mean and standard deviation. but, the code was written by you, needs x( user have to determine that). in the other word, I want to conduct simulation experiment base on specified parameters.

0

Can I do that by this:

```
//covariance matrix
cov = { 1 0.3,
0.3 1 };
//mean for each column of 'cov'
mu = { 0, 0 };
x = rndMVn(100, mu, cov);
```

If it is correct then please guide me how can I use two different variance?

0

You can change the standard deviation by multiplying the output by the desired standard deviation like this

```
//covariance matrix
cov = { 1 0.3,
0.3 1 };
//mean for each column of 'cov'
mu = { 0, 0 };
var = 9;
sd = sqrt(var);
x = rndMVn(100, mu, cov) .* sd;
```

## Your Answer

## 4 Answers

If you mean you want to compute the normal probability density function of the normal distribution with a specified mean and standard deviation, you can do this

```
p = pdfn2(2.1, 1.1, 1.5);
proc (1) = pdfn2(x, m, sd);
retp(pdfn((x-m)./sd)./sd);
endp;
```

You know, I want to produce data which have the normal distribution with specified mean and standard deviation. but, the code was written by you, needs x( user have to determine that). in the other word, I want to conduct simulation experiment base on specified parameters.

Can I do that by this:

```
//covariance matrix
cov = { 1 0.3,
0.3 1 };
//mean for each column of 'cov'
mu = { 0, 0 };
x = rndMVn(100, mu, cov);
```

If it is correct then please guide me how can I use two different variance?

You can change the standard deviation by multiplying the output by the desired standard deviation like this

```
//covariance matrix
cov = { 1 0.3,
0.3 1 };
//mean for each column of 'cov'
mu = { 0, 0 };
var = 9;
sd = sqrt(var);
x = rndMVn(100, mu, cov) .* sd;
```