# I can't implement plateau limit histogram equalization algorithm using MATLAB

i tried to implement this research paper using MATLAB. Unfortunately, my result is not same with the original result.

Here is my try step by step:

histogram_of_image = imhist(input_image);
a = uint8(2); %according to research paper
beta = uint8(2); %according to research paper
for i=1:256
modified_histogram(i)  = (log( histogram_of_image(i)+double(a)))^double(beta);
end


for i=1:256
if(modified_histogram(i)~=0)
sum1 = sum1 + (modified_histogram(i));
cnt = cnt + 1;
end
end
tcl = sum1/cnt;
clipped_histogram = zeros(1,256);
for i=1:256
if((modified_histogram(i)) >= tcl)
clipped_histogram(i) = tcl;
else
clipped_histogram(i) = (modified_histogram(i));
end
end


PDa = zeros(1,256);
for i=1:256
PDa(i) = clipped_histogram(i) / (sum(clipped_histogram));
end
CDa = zeros(1,256);  %create CDa in formula
CDa(1) = PDa(1) ;
for i=2:256
CDa(i) =  PDa(i) +  CDa(i-1);
end
value_after_enhancement =  zeros(1,256);
for i=1:256
value_after_enhancement(i) = (255 * CDa(i)); %maximum gray level is 255 and minimum grey level is 0
end
b=uint8(0);
output_image=zeros(width,height);
for i=1:width %map new values
for j=1:height
b = input_image(i,j);
output_image(i,j) =   value_after_enhancement(b);
end
end


and if you would like to see, here is my all code