problems with plotting density function
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Parametric Spectral Estimation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!