How to compute uniform cumulative distribution functions without an existing unifcdf (error UndefinedFunction)?

1 view (last 30 days)
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?

Answers (1)

John D'Errico
John D'Errico on 5 Aug 2017
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 Comments
John D'Errico
John D'Errico on 6 Aug 2017
Edited: John D'Errico on 6 Aug 2017
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.
Glazio
Glazio on 6 Aug 2017
Edited: Glazio on 14 Aug 2017
@ John D'Errico:
Thanks for your answer and your help to write this function.
Now I have a m-file called unifcdf.m, which contains the function to compute the unif-cdf.
The following error message occurs:
Error using feval
Undefined function 'unifcdf' for input arguments of type 'double'.
The file is located in the same path as the executable file.
Why is there still this error message?

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!