Integrating a truncated normpdf

I have a function multiplied by a normal distribution that I can integrate in the following manner:
f2 = @(theta) f1(theta)*normpdf(theta)
ans = integral(f2,-k,k)
and everything is okay and great. However, I need normpdf(theta) to be truncated from -k to k. Truncate() only seems to work for makedist() which would get rid of the anonymous function I need for the integral. The closest solution I can find is here: https://www.mathworks.com/matlabcentral/newsreader/view_thread/100921 but the link to the tutorial is broken and I'm not sure if mle is the answer to my problem...
Thank you in advance for any advice

댓글 수: 4

Star Strider
Star Strider 2017년 4월 11일
f1 = ?
Christina
Christina 2017년 4월 11일
f1 =@(theta)(1 - 1/(5+2*x))*((100+theta+s)^(0.5)) / (0.5) + (1/(5+*x))*((100+theta+s-5)^(0.5))/(0.5) where x and s are syms found using fsolve(); the integral is part of the equations being passed into fsolve
Torsten
Torsten 2017년 4월 12일
Why don't you insert the explicit formula for the truncated normal from -k to k ?
https://en.wikipedia.org/wiki/Truncated_normal_distribution
Best wishes
Torsten.
Christina
Christina 2017년 4월 12일
편집: Christina 2017년 4월 12일
Thank you Torsten for your reply (and you too Star Strider). That link really helped me understand what was going on in that question I linked to. I did find a work-around that I'll share.
pd = truncate(makedist('Normal'),-k,k);
integral(@(theta)pdf(pd,theta),-k,k)

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2017년 4월 11일

편집:

2017년 4월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by