How to plot a histogram showing percentage change?
7 ビュー (過去 30 日間)
古いコメントを表示
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 件)
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!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!