Extending or doubling a histogram
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Krispy Scripts
am 16 Dez. 2016
Kommentiert: Krispy Scripts
am 16 Dez. 2016
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.
0 Kommentare
Akzeptierte Antwort
the cyclist
am 16 Dez. 2016
load example x
[N,edges] = histcounts(x,-3:0.25:3);
figure
bar([edges(1:end-1) edges(1:end-1)+6],[N N])
Weitere Antworten (1)
the cyclist
am 16 Dez. 2016
Bearbeitet: the cyclist
am 16 Dez. 2016
(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)
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!