How to derive a CDF from a given PDF?
4 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Tom Lane
on 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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!