MATLAB: Divide histogram in three parts

MATLAB

Hi, I want to divide the histogram in three parts and define the ranges of three parts.
minRed = min(red(:));
maxRed = max(red(:));
AvgRed = (minRed+maxRed)/3;
AvgRed2 = AvgRed+AvgRed;
But sometimes the value of AvgRed becomes less than minRed and value of AvgRed2 exceeds the maxRed. What is the correct way to do this?

Best Answer

A + (B - A) /3
A + (B - A) /3 *2
Related Question