2021年美赛A题趋势图绘制Matlab代码实现
clearvars; clc; % decomposition_rate_trend
target_path = 'D:\SJTU大三(上)总\杂项\科研项目\2021MCM\regulation_test\figures\tendency_chart\matlab_fig\DR_tendency_chart.png';
decomposition_rate_data_mat = importdata('D:\SJTU大三(上)总\杂项\科研项目\2021MCM\regulation_test\data\raw data\xlsx format\Diversity.xlsx');
decomposition_rate_data_mat = decomposition_rate_data_mat.data;
time_series = decomposition_rate_data_mat(:, 1);
a_type_rate = decomposition_rate_data_mat(:, 2);
o_type_rate = decomposition_rate_data_mat(:, 3);
as_type_rate = decomposition_rate_data_mat(:, 4);
aos_type_rate = decomposition_rate_data_mat(:, 5);
clear decomposition_rate_data_mat;
figure(1);
set(gca, 'xlim', [0, 360]); hold on;
plot(time_series, a_type_rate, 'LineWidth', 1); hold on;
plot(time_series, o_type_rate, 'LineWidth', 1); hold on;
plot(time_series, as_type_rate, 'LineWidth', 1); hold on;
plot(time_series, aos_type_rate, 'LineWidth', 1); hold on;
clear a_type_rate o_type_rate as_type_rate aos_type_rate;
grid on;
legend('Type-A', 'Type-O', 'Type-AS', 'Type-AOS');
xlabel('Days', 'FontSize', 15); ylabel('DR', 'FontSize', 15); title('Tendency Chart of DR', 'FontSize', 13);
saveas(gcf, target_path); clear target_path; close all;
效果图

本文介绍了一段使用Matlab绘制2021年美赛A题中不同类型分解率随时间变化趋势图的代码实现过程。通过导入实验数据并设置图表样式,最终生成了清晰直观的趋势图。
7395

被折叠的 条评论
为什么被折叠?



