problems with plotting density function
이전 댓글 표시
Hi, I have 2 dimensional distribution where one dimension are random binary numbers and the other are random real numbers with support [-2,2]. So the data looks like this:
1.0000 -1.3044
1.0000 -0.5507
1.0000 -1.0699
1.0000 -1.3371
1.0000 0.7970
1.0000 -0.4662
0 -0.7049
0 0.0364
0 -1.0314
1.0000 0.0046
Lets call first column x and second y. I'm interested in plotting objects P(x=1|y<Y) and corresponding density (as functions of Y). I can plot cdf Prob(x=1|y<Y) as function of Y, but I'm having problems with plotting corresponding density. I have tried to do something like this:
m=100;
xpv=linspace(-2,2,m);
for i=2:m
pdf_e(i)=(cdf(xpv(i)h)-cdf(xpv(i-1)))/(xpv(i)-xpv(i-1));
end
where cdf(a) = Prob(x=1|y<a) but it gives me something really strange. (cdf function works fine by the way).Can someone please help me with this.
Thanks, Kenan
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Uniform Distribution (Continuous)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!