Extending or doubling a histogram

조회 수: 1 (최근 30일)
Krispy Scripts
Krispy Scripts 2016년 12월 16일
댓글: Krispy Scripts 2016년 12월 16일
I have data that I have plotted into a histogram from around -3 to 3. I want to basically take the histogram and repeat it once to the right, so it will be the original histogram from -3 to 3 and the histogram repeated from around 3 to 6.
Does this make sense and/or is it possible?
I attached the example matrix.

채택된 답변

the cyclist
the cyclist 2016년 12월 16일
load example x
[N,edges] = histcounts(x,-3:0.25:3);
figure
bar([edges(1:end-1) edges(1:end-1)+6],[N N])

추가 답변 (1개)

the cyclist
the cyclist 2016년 12월 16일
편집: the cyclist 2016년 12월 16일
(I assume you mean the new one will extend from 3 to 9, with the same width of 6.)
If x is the data from your original histogram, then the simplest thing to do is probably just replicate the data itself, but translated:
x2 = [x x+6];
and then
figure
histogram(x2)
  댓글 수: 1
Krispy Scripts
Krispy Scripts 2016년 12월 16일
This adds error because the max*2 is 6.28 and when added is not the exact same data because it adds variation

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

카테고리

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