How to plot mean with respect to bins?

조회 수: 3 (최근 30일)
Sritoma Bose
Sritoma Bose 2021년 8월 30일
댓글: Sritoma Bose 2021년 9월 14일
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?

답변 (1개)

Wan Ji
Wan Ji 2021년 8월 30일
Hi friend,
Use histcounts and histogram, then the work is done
clc;clear
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);
histogram('BinEdges',edges,'BinCounts',N)
  댓글 수: 2
Adam Danz
Adam Danz 2021년 8월 30일
Or, if the averages are already stored somehwere,
x = 0 : 0.2 : 1;
averages = rand(1,numel(x)-1);
histogram('BinEdges',x,'BinCounts',averages)
Sritoma Bose
Sritoma Bose 2021년 9월 14일
Thank you,this was helpful

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by