MATLAB: How to solve the following Probability density function in matlab


Hello, i am very new to Matlab and got this question in assignment which i need to submit soon. Any help with coding and a bit explanation would be appreciated.
A probability density function (PDF) is given as follows:
1/4 0<=x<3
f(x) =
5/8-(1/8)x 0<=x<=5
  1. Plot the PDF in Matlab.
  2. Calculate and plot the CDF.
  3. Demonstrate analytically that the mean value associated with the PDF is 49/24.
The answer to the question should be the plots of the PDF and the CDF, as well as the analytical calculation of the mean value.

Best Answer

  • There is an obvious misprint in the stated interval. It should be:
    1/4 0<=x<3
    f(x) =
    5/8-(1/8)x 3<=x<=5
    As to answering (3.), it all depends on your remembering your calculus enough to be able to integrate a constant times x and a constant times x^2. I think they want this one done by hand. Also you need to know what the definition of "mean value" is.