How to draw a density function?

1 visualización (últimos 30 días)
googo
googo el 14 de Abr. de 2013
Suppose I have :
x = 1-2 frequency 5 probability 1/2 x= 2-4 frequency 3 probability 3/10 x = 4-6 frequency 2 probability 2/10
and I want to draw it... how can I do it?

Respuestas (2)

Youssef  Khmou
Youssef Khmou el 14 de Abr. de 2013
hi,
you mean probability density function ?
try :
doc pdf
For example, you want to draw the Normal PDF over the range [-10:10] with N(0,1):
x=-10:0.1:10;
Y=pdf('norm',x,0,1);
figure, plot(x,Y), title(' Normal distribution N(0,1)');
'pdf' function can draw up to 23 distributions,

Wayne King
Wayne King el 14 de Abr. de 2013
This appears to be a simple discrete random variable with a probability mass function. The problem is that in that case, you cannot have assignments like 1-2, 2-4
The outcome 2 cannot be assigned two different probabilities: 5/10 and 3/10.
Further, this cannot be a distribution with probability assigned to the intervals you give with discontinuities at the interval endpoints because that would not yield a valid probability density function. The total measure (integral) of those step functions would exceed 1.
Here is a valid probability mass function. I'll just assign the probability at the midpoint of the interval (but that may not be correct for your case)
x = [1.5 3 5];
y = [1/2 3/10 2/10];
bar(x,y)

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by