Function to convert empirical distribution to uniform distribution in Matlab?

I know the procedure for converting one distribution to another using CDF. However, I would like to know if Matlab has an existing function that can perform this task?

My other question is that I calculated the CDF of my empirical function ecdf()in Matlab for distribution with 10,000. However, the output I get from it contains only values 9967. How can I get general values 10,000for my CDF? Thank.

0
source share
3 answers
for t=1:nT 
    [f_CDFTemp,x_CDFTemp]=ecdf(uncon_noise_columndata_all_nModels_diff_t(:,1,t)); % compute CDF of empirical distribution
    f_CDF(1:length(f_CDFTemp),t) = f_CDFTemp; % store the CDF of different distributions with unequal size in a new variable
    x_CDF(1:length(x_CDFTemp),t) = x_CDFTemp;
    b_unifdist=4*t;
    [Noise.N, Noise.X]=hist((a_unifdist+(b_unifdist-a_unifdist).*f_CDF(:,t)),100); % generate the uniform distribution by using the CDF of empirical distribution as the CDF of the uniform distribution
    generatedNoise(:,:,t)=emprand(Noise.X,nRows,nCol); % sample some random numbers from the uniform distribution generated above by using 'emrand' function
end
+1
source

, , , CDF. CDF erf Matlab.

:

C = @(x)(0.5 * (1 + erf(x/sqrt(2))));

x = randn(1,1000);  % Zero-mean, unit variance
y = C(x);           % Approximately uniform
+1

This is not exactly what you are looking for , but it shows how to do the opposite. Reversing it should not be so bad.

0
source

All Articles