How to derive a CDF from a given PDF?

3 vues (au cours des 30 derniers jours)
Zheng
Zheng le 8 Nov 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.

Réponses (1)

Tom Lane
Tom Lane le 9 Nov 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.

Community Treasure Hunt

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

Start Hunting!

Translated by