plot shifting while using histcounts
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I'm trying to compare 2 spectrums but I get this shifting in the X-axis (the blue spectrum is processed data out the red one), my suspition is that it happened since I'm using histocounts.
this is the plot script:
[X,~] = histcounts(X_table.energy,2744);
semilogy(X,'r')
% xlim([1 2000])
hold on
[Z,~] = histcounts(Y,2744);
semilogy(Z,'b')
% xlim([1 2000])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277415/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Rik
am 16 Mär. 2020
You are specifying the number of bins, not the exact bins. Then when you are plotting you don't specify the x-value. If you change either of these the data should align again.
4 Kommentare
Rik
am 16 Mär. 2020
Well, you don't need to, but if you want to compare two sets of data you should be using the same bins, so you can't let Matlab figure out the bins automatically.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations 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!