How to plot a histogram showing percentage change?

7 ビュー (過去 30 日間)
inspiration
inspiration 2019 年 5 月 2 日
回答済み: Kanishk 2025 年 7 月 3 日
I have 20 subjects divided equally into 2 classes A and B. Each class has a 10x1 vector, that has the percentage change of brain tissue for 10 subjects. I need to plot a historam depicting this percentage change in brain tissue for both the classes. Any help is appreciated.
  1 件のコメント
KSSV
KSSV 2019 年 5 月 2 日
Read about hist , histogram.

サインインしてコメントする。

回答 (1 件)

Kanishk
Kanishk 2025 年 7 月 3 日
Hello Insipiration,
You can plot Histograms in MATLAB using "histogram" function. You can learn more about the "histogram" function from this MATLAB documentation.
You can use the following code to plot overlapping histograms:
A = randn(10,1) * 5 + 10;
B = randn(10,1) * 5 + 12;
figure;
histogram(A, 'BinWidth', 2, 'FaceAlpha', 0.6, 'FaceColor', 'b');
hold on;
histogram(B, 'BinWidth', 2, 'FaceAlpha', 0.6, 'FaceColor', 'r');
hold off;
legend('Class A', 'Class B');
xlabel('Percentage Change in Brain Tissue');
ylabel('Number of Subjects');
title('Histogram of Brain Tissue Change by Class');
grid on;
Cheers!

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by