Posted on

# Learn MATLAB Episode #26: Continuous Variables In this lecture we’re going to talk about continuous variables, so we’ve talked about discrete variables up until now. Discrete variables can only take on distinct values, but continuous variables can take on any value. So with continuous variables we don’t have a notion of probabilities for exact values because X can take on an infinite number of values, so the probability of equaling any specific exact value is zero. We can have probabilities for ranges though. So, for example, we can say the probability of X being between 3.13 and 3.15 is greater than zero. We have a useful function called the cumulative distribution function, or the CDF, that helps us measure such probabilities. We usually label this function as big F of X, and so the definition of F(X) is it’s the probability that the random variable big X is greater than negative infinity, but less than little x. Note that the probability of big X being between negative infinity and positive infinity is 1 since X has to take on a value, therefore the value of big F of positive infinity is equal to 1. Now how about going back to our original problem if we want to calculate the probability that X is between 3.13 and 3.15. That would just be big F of 3.15 minus big F of 3.13. So now let’s talk about the other useful function when we’re talking about continuous variables. This one’s called the probability density function, or the PDF. We usually denote it by little f of X, and it is defined as the derivative of big F of X with respect to X, so it’s like the slope of big F of X. Note that this function can be greater than one since it’s not a probability, it is a probability density f of X, little f of X does have to be greater than or equal to 0 though. So here’s one example where little f of X can be bigger than one. So, let’s say little f of X is uniform between zero and 0.1, so that means if you try to sample from this random variable X you’ll always get a value between zero and 0.1, and the probability of any particular value is equal to all the others. Now I’m going to claim that little f of x has to equal 10 if X is between 0 and 0.1, and 0 otherwise. Now why is this, because big F of X. Since little f of X is the derivative of big F of X, big F of X is the integral of little f of X. In the integral we can take the constant out and then calculate the integral from 0 to X. Now we know that from above big F of infinity has to equal 1, so the integral from minus infinity to infinity equals to 1, but since little f of x is 0 after 0.1. we can just take the integral from 0 to 0.1. That gives us 0.1c, and if we solve for c, c equals 10. Therefore, we’ve seen a scenario where little f of X can have a value greater than one because it’s a probability density, and not a probability value. Later on in this course we’ll look at more complex continuous distributions.