How to plot mean with respect to bins?

5 views (last 30 days)
Sritoma Bose
Sritoma Bose on 30 Aug 2021
Commented: Sritoma Bose on 14 Sep 2021
I need to make 6 bins:Condition:<0.2;>0.2<0.4;>0.4<0.6;>0.6<0.8;>0.8<1,>1
For each bins i have got some mean values,now i have to plot these means in respective bins.The x axis will be having the bins,and y axis is the mean variable.So how do I do that?

Answers (1)

Wan Ji
Wan Ji on 30 Aug 2021
Hi friend,
Use histcounts and histogram, then the work is done
value = rand(100,1) + 0.1; % lack of your data, i generate it myself
x = [0.0,0.2, 0.4, 0.6,0.8,1.0,1.2]; % you can set 0.0 to min(value) and 1.2 to max(value)
[N, edges] = histcounts(value,x);

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!