How do I truncate a normally distributed random variable?

1 次查看(过去 30 天)
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
https://de.mathworks.com/help/stats/prob.truncatabledistribution.truncate.html
Best wishes
Torsten.

Community Treasure Hunt

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

Start Hunting!

Translated by