Info
此问题已关闭。 请重新打开它进行编辑或回答。
Define distribution function to be zero if ecdf(X) is not defined
1 次查看(过去 30 天)
显示 更早的评论
I have a distribution of random numbers X in the interval [50,100]. When using the function ecdf(X) to receive the empirical cumulative distribution function, the values for x<50 are not defined.
I the following, I want to integrate (1-ecdf(X)) from 0 to infinity and therefore need the ecdf(X) to be zero.
Is there a possibility to define the ecdf(X) to be zero for x<50?
0 个评论
采纳的回答
Torsten
2017-11-9
[f,x] = ecdf(X);
Ecdf=@(p) interp1(x,f,p)*(p>=50)
Best wishes
Torsten.
6 个评论
Torsten
2017-11-9
编辑:Torsten
2017-11-9
If you integrate from the first x-value to the last x-value (as the command
"trapz(x,Distribution_distorted)"
does), you automatically ensure that the CDF is counted to be zero outside the interval where its mass is concentrated (namely outside [x(1);x(end)]). And I guess this is what you want.
Best wishes
Torsten.
更多回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!