How to compute uniform cumulative distribution functions without an existing unifcdf (error UndefinedFunction)?
1 回表示 (過去 30 日間)
古いコメントを表示
For a sensitivity analysis, the calculation of the uniform-cdf is required (within a m-script).
In Matlab R2012a (Student-Version) the calculation of the uniform cumulative distribution function runs with unifcdf without problems.
If I move the entire calculation to a HPC (cluster -> compiling -> standalone version -> run standalone version) due to computer performance, the following error message appears:
Error using feval
Undefined function 'unifcdf' for input arguments of type 'double'.
Error in AAT_sampling_extend (line 108)
Error in extended_sample (line 66)
MATLAB:UndefinedFunction
The Matalb version R2017a is installed on this cluster. The statistics toolbox is available (and both functions feval and unifcdf).
I've tried the following:
I have written a function unifcdf within a m-file and provided it MATLAB. However, the same error message appeared.
How can I solve this problem?
0 件のコメント
回答 (1 件)
John D'Errico
2017 年 8 月 5 日
This seems a bit silly. The CDF of a uniform distribution is a straight line, running from the min to the max of the data. WTP?
3 件のコメント
John D'Errico
2017 年 8 月 6 日
編集済み: John D'Errico
2017 年 8 月 6 日
Surely you are not telling me that you cannot write a function called unifcdf that computes and uses the necessary straight line?
You must know the limits of the uniform distribution, else it is undefined, and you could never have used unifcdf in the first place. So the straight line CDF is trivial to write, and thus use. WTP?
Lets see, a uniform distribution has a CONSTANT PDF on the domain [a,b]. Therefore we know that
P(x) = 1/(b-a), for x in the interval [a,b]
Next, we need to integrate a constant function over that interval. EUREKA! The CDF is a line segment on the support of the PDF! The CDF is zero at x==a, and zero below that point. At and above x==b, the CDF is 1, and it is linear between those points. Start like this:
function p = unifcdf(x,a,b)
%Compute p here, as a function of x, a, b
p = zeros(size(x));
p(x>b) = 1;
...
That gets you started. Now you need to fill in the line part, for x>a & x<b.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!