area under a pdf not 1?

조회 수: 9 (최근 30일)
Abhinav
Abhinav 2017년 7월 20일
댓글: Abhinav 2017년 7월 20일
I have convoluted two pdfs. Both of my pdfs are exponential with lambda=10 and 20, respectively. I have used the following code:
fun1=@(x)exppdf(x,10);
fun2=@(x)exppdf(x,20);
x=0:30;
y=conv(fun(x),fun2(x));
The code above gives the vector y with 61 elements in it. When I used the 'trapz(0:60,y)' function to find the area under the curve y, it gives 0.80 as output. However, the area should be one since y represents a pdf. I suspect that it is due to the error associated with integration via 'trapz'.
But I need to confirm that I am getting a valid pdf. What function can I use instead of trapz. I cannot use the function 'integral', because it requires functional form of convolution output which I don't have.
Any suggestions?

채택된 답변

Star Strider
Star Strider 2017년 7월 20일
It has approximately unity area:
fun1 = @(x)exppdf(x,10);
fun2 = @(x)exppdf(x,20);
y = @(x) conv(fun1(x),fun2(x));
x = linspace(0, 100);
yint = trapz(y(x))
yint =
1.0474
It is necessary to bear in mind the support of PDFs. Integrate it over its entire length.
  댓글 수: 5
Star Strider
Star Strider 2017년 7월 20일
Not really. After experimenting a bit, it seems to be a function of the length of ‘x’, so there must be some sort of normalization factor involved. Beyond that, I’m not sure. I’ll think about this and if I come up with anything, I’ll post back.
Abhinav
Abhinav 2017년 7월 20일
Okay.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by