필터 지우기
필터 지우기

use matlab code to draw the joint PMF and CDF

조회 수: 12 (최근 30일)
Ee
Ee 2021년 11월 27일
편집: Chunru 2021년 11월 28일
Hi, I am here confused about how to use 3D plot to draw the PMF (Probability Mass function) and CDF(Cumulative Distribution Function) based on x y two random variables. (The PMF I can draw it on paper but have no idea how to generate a code). Appreciate for the help
I tried the code below but it did not generate the graph what it supposed to be.
plot3([0 0 0],[0 0 0],[0 0 0.25])
hold on
plot3([1 0 0],[0 0 0],[0 0 0.125])
plot3(1, 0, 2)
hold on
plot3([0 0 0],[0 1 0],[0 0 0.5])
hold on
xlabel('X')
ylabel('Y')
zlabel('Probability')
grid on

답변 (1개)

Chunru
Chunru 2021년 11월 28일
편집: Chunru 2021년 11월 28일
[x, y] = meshgrid([0 1], [0 1])
x = 2×2
0 1 0 1
y = 2×2
0 0 1 1
z = [0.25 0.5; 0.125 0.125]';
stem3(x, y, z)
xlabel('x');
ylabel('y');
zlabel('p')

카테고리

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