필터 지우기
필터 지우기

calculate the PMF of y (sum of three dices) and plot it

조회 수: 12 (최근 30일)
Ee
Ee 2021년 10월 28일
댓글: Ee 2021년 10월 31일
Hello
I pretty confused about how to calculate the PMF of sum of three dices (represented by y such as 3,4,5...18) and how to plot its PMF using Matlab.
I feel like we need to use hist function but have no idea where to start. Hope someone can help me figure out!

채택된 답변

Image Analyst
Image Analyst 2021년 10월 29일
Not sure what PMF is. Did you ever actually try histogram()?
numRolls = 1000000;
numDice = 3;
dieFaces = randi([1, 6], numRolls, numDice);
theSums = sum(dieFaces, 2);
histObject = histogram(theSums, 'Normalization','pdf')
grid on;
xlabel('Sums');
ylabel('PDF')
  댓글 수: 7
Paul
Paul 2021년 10월 31일
One you know the PMF, for example from the Values of histObject above, the function
doc cumsum
would be of interest for computing the CDF. The functions
doc stem
doc stairs
would be of interest for plotting the CDF.
Ee
Ee 2021년 10월 31일
Thank you! I will try!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by