MATLAB Answers

0

how to calculate integral pdf ?

Asked by Priscilla Schmitz on 30 May 2019
Latest activity Commented on by the cyclist
on 30 May 2019
Hi,
I have pdf (probability density function) of my outputs but i dont know how to determine the probability that x1<x<x2 by calculating Integral(P(x)) between x1 and x2 on MATLAB...
ANY HELP? :D

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by the cyclist
on 30 May 2019
 Accepted Answer

The probability is the integral of the PDF over a range. You can approximate that integral as a sum:
pdf = @(x) 2*x;
x1 = 0;
x2 = 1;
dx = 0.0001;
xrange = x1 : dx : (x2-dx);
probability = sum(pdf(xrange)*dx)
Note that I have done the approximation very crudely, just to keep things simple. Better approximations are possible.

  2 Comments

what is dx?
the cyclist
on 30 May 2019
It represents the width of a tiny slice of the area under the curve, as you do the integral.
In the limit that dx --> 0, you get the integral (rather than the sum).
[Real mathematicians, please do not shoot me! I know that I am being a bit loose here. But I can't explain all of calculus!]

Sign in to comment.