How do I truncate a normally distributed random variable?

I have a random variable 'y' that follows the normal distribution. For example:
x = -4:0.1:4;
y = normpdf(x);
I need to create another vector consisting of elements of 'y' truncated at a certain point, how do I do that?

 채택된 답변

Torsten
Torsten 2017년 7월 11일
편집: Torsten 2017년 7월 11일
xtl = 2.0; % left point of trunction
xtr = Inf; % right point of truncation
x = -4:0.1:4;
y = normpdf(x);
yt = normpdf(x)/(normcdf(xtr)-normcdf(xtl)).*(x>=xtl).*(x<=xtr);
Best wishes
Torsten.

추가 답변 (1개)

Torsten
Torsten 2017년 7월 11일

0 개 추천

https://de.mathworks.com/help/stats/prob.truncatabledistribution.truncate.html
Best wishes
Torsten.

댓글 수: 1

This is only applicable to the probability distribution objects.

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

질문:

2017년 7월 11일

편집:

2017년 7월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by