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

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (1)

John D'Errico
John D'Errico il 5 Ago 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 Commenti
John D'Errico
John D'Errico il 6 Ago 2017
Modificato: John D'Errico il 6 Ago 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 il 6 Ago 2017
Modificato: Glazio il 14 Ago 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?

Accedi per commentare.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by