change in histogram distributions

조회 수: 5 (최근 30일)
Sumera Yamin
Sumera Yamin 2020년 12월 9일
편집: Sumera Yamin 2020년 12월 11일
Hi, is it possible to flip a histogram around the peak value? I do not want to flip the axis. Just for performing some checks, I want to invert my distribution from negative skewness to positive skewness, keeping the mean value at its original value. any help is appreciated.

채택된 답변

Théophane Dimier
Théophane Dimier 2020년 12월 9일
편집: Théophane Dimier 2020년 12월 9일
Hi!
It should be doing the following (considering that a is your input)
[counts,center]=hist(a);
bar(center,counts);
hold on
center_mirror=flip(center);
bar(center_mirror,counts);
This should plot the histogram and the mirrored histogram.
If you want to force it to rotate around the peak (conservation of the mode of the distribution):
[counts,center]=hist(a);
bar(center,counts);
hold on
[~,idx]=max(counts);
center_mirror=2*center(idx)-center;
bar(center_mirror,counts);
I hope it answers your question!
  댓글 수: 9
Image Analyst
Image Analyst 2020년 12월 11일
The cryptic idx should have been called something more explicit and descriptive, like "indexOfMax". Basically it's the first index (bin number) where the max value (mode) of the histogram appears. Does that explain it better.
Sumera Yamin
Sumera Yamin 2020년 12월 11일
편집: Sumera Yamin 2020년 12월 11일
ok, thanks, i understood it now.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by