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?

 Akzeptierte Antwort

Torsten
Torsten am 11 Jul. 2017
Bearbeitet: Torsten am 11 Jul. 2017
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.

Weitere Antworten (1)

Torsten
Torsten am 11 Jul. 2017

0 Stimmen

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

1 Kommentar

This is only applicable to the probability distribution objects.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by