problems with plotting density function
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Uniform Distribution (Continuous) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!