matlab normpdf
时间: 2023-11-02 16:01:21 浏览: 94
matlab pdf
The `normpdf` function in MATLAB is used to compute the probability density function (PDF) of a normal distribution at a given point or set of points. Its syntax is:
```
y = normpdf(x, mu, sigma)
```
where `x` is a scalar or array of values at which to evaluate the PDF, `mu` is the mean of the normal distribution, and `sigma` is the standard deviation of the normal distribution. The function returns the value of the PDF at each point in `x`, given the specified parameters.
For example, to compute the PDF of a normal distribution with mean 0 and standard deviation 1 at the values -3, -2, -1, 0, 1, 2, and 3, we could use the following code:
```
x = [-3 -2 -1 0 1 2 3];
mu = 0;
sigma = 1;
y = normpdf(x, mu, sigma);
```
The resulting vector `y` would contain the values of the PDF at each point in `x`.
阅读全文