Hi everyone,
Please see the code below. I tried to sample from a truncated normal distibution but the sample histogram is not matching with the actual truncated distribution plot. Can anyone help me with this.
t = 0.01;
n = 10000;
d_mu = 0.0052;
d_COV = 61.35;
d_sig = d_COV*d_mu/100;
pd = makedist('Normal','mu',d_mu,'sigma',d_sig);
tpd = truncate(pd,0,t);
d_norm = random(pd,n,1);
d_tnorm = random(tpd,n,1);
x = linspace(-.01,.02,n);
figure
plot(x,pdf(pd,x))
hold on
plot(x,pdf(tpd,x),'LineStyle','--')
histogram(d_tnorm,30)
legend('Normal','Truncated','Truncated bar')
hold off
0 Comments
Sign in to comment.