How do i compare graphs ( plots ).

10 ビュー (過去 30 日間)
Mitesh Bhavsar
Mitesh Bhavsar 2015 年 3 月 16 日
回答済み: TED MOSBY 2024 年 11 月 22 日 9:56
How can i compare the graph ( plots ) like area & stacked bar plots. Is there any option to find out the similarity between them?

回答 (1 件)

TED MOSBY
TED MOSBY 2024 年 11 月 22 日 9:56
Although visual inspection is the most straightforward way to compare the plots, but you can try the following methods to find the similarity in your plots:
Numerical comparison:
Calculate the correlation coefficient to measure similarity.
% Example data
x = 1:10;
y1 = rand(1, 10); % Data for area plot
y2 = rand(1, 10); % Data for stacked bar plot
correlation = corrcoef(y1, y2);
disp(['Correlation between datasets: ', num2str(correlation(1,2))]);
Overlay Plots:
figure;
hold on;
area(x, y1, 'FaceAlpha', 0.5, 'FaceColor', 'r');
bar(x, y2, 'stacked', 'FaceAlpha', 0.5, 'FaceColor', 'b');
title('Overlay of Area and Stacked Bar Plot');
legend('Area Plot', 'Stacked Bar Plot');
hold off;
Statistical Analysis:
% Compute Mean Squared Error
mse = mean((y1 - y2).^2);
disp(['Mean Squared Error between datasets: ', num2str(mse)]);
Hope it helps!

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by