MATLAB: How to normalize y axis

normalize mean of y axis

hi, i want to plot the mean percentage of y of each bin of x, (percentage of mean dose) at binned distances. this code is working and i got result of mean dose at each bin, but i need to normalize the y axis (mean of each binned x axis), so i can have % of y, any idea please?
load Bladder_dist_dose.txt; x=Bladder_dist_dose(:,1); y=Bladder_dist_dose(:,3); counter = 1
for m= (min(x)):0.5 : (max(x))
interval = x > m & x < m+0.5;% after running the loop it keeps the run results
distance(counter,1) = mean(x(interval));
Mean_dose_interval(counter,1) = mean(y(interval));
err (counter,1) = std(y(interval)); mean(y(interval))
counter=counter+1;
end
errorbar(distance, Mean_dose_interval,err,'r'); xlabel('Distance to PTV [cm]'); ylabel('Mean dose at distance [Gy]')

Best Answer

Why not simply use histogram()???