How to derive a CDF from a given PDF?

5 visualizaciones (últimos 30 días)
Zheng
Zheng el 8 de Nov. de 2012
Here is the pdf fucntion: skn = 2.*(1/sqrt(2*pi)).*exp(-0.5*x.^2).*normcdf(a.*x,0,1); How can I define a CDF function from it? Also, after I have CDF, How can I find inverse of that CDF? Thanks.

Respuestas (1)

Tom Lane
Tom Lane el 9 de Nov. de 2012
If you have the Symbolic Toolbox, you might try replacing normcdf by an erf function and see what you get.
Otherwise you could try something like this:
x = linspace(-5,5);
a = pi;
f = @(x) 2.*(1/sqrt(2*pi)).*exp(-0.5*x.^2).*normcdf(a.*x,0,1);
F = zeros(size(x));
for j=1:length(x)
F(j) = integral(f,-Inf,x(j));
end
plot(x,F)
For the inverse cdf, you might try interpolating or using fzero.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by