How do I truncate a normally distributed random variable?

1 vue (au cours des 30 derniers jours)
Yerzhigit Bapin
Yerzhigit Bapin le 11 Juil 2017
Modifié(e) : Torsten le 11 Juil 2017
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?

Réponse acceptée

Torsten
Torsten le 11 Juil 2017
Modifié(e) : Torsten le 11 Juil 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.

Plus de réponses (1)

Torsten
Torsten le 11 Juil 2017
https://de.mathworks.com/help/stats/prob.truncatabledistribution.truncate.html
Best wishes
Torsten.
  1 commentaire
Yerzhigit Bapin
Yerzhigit Bapin le 11 Juil 2017
This is only applicable to the probability distribution objects.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by