matlab finitepmf,!!Intuitive Probability and Random Processes Using MATLAB_2006
时间: 2024-02-24 08:58:30 浏览: 69
MATLAB官网1200份Simulink资料汇总.pdf
The function "finitepmf" in MATLAB is used to calculate the probability mass function (PMF) for a finite random variable.
To use this function, you need to provide two arguments: the first argument is a vector containing the possible values of the random variable, and the second argument is a vector containing the corresponding probabilities for each of those values.
For example, if X is a random variable that can take on the values 1, 2, and 3 with probabilities 0.2, 0.5, and 0.3, respectively, you can calculate the PMF using the following code:
```
x = [1 2 3];
p = [0.2 0.5 0.3];
pmf = finitepmf(x, p);
```
The output "pmf" will be a vector containing the PMF values for each of the possible values of X.
Note that the probabilities in the second argument must sum to 1, otherwise the function will return an error.
阅读全文