首先上官方教程链接
polarplothttps://ww2.mathworks.cn/help/matlab/ref/polarplot.html
上实例
% 定义角度向量和径向向量
theta = linspace(0, 2*pi, 5);
r1 = [1, 2, 1.5, 2.5, 1];
r2 = [2, 1, 2.5, 1.5, 2];
% 绘制两个雷达图
polarplot(theta, r1, 'r-', 'LineWidth', 2);
hold on;
polarplot(theta, r2, 'b--', 'LineWidth', 2);
% 添加填充颜色
% fill(theta, r1, 'r', 'FaceAlpha', 0.3,'EdgeColor',[0.5 0.2 0.55],'LineWidth',3);
% fill(x,y,'r','FaceAlpha',0.3,'EdgeColor',[0.5 0.2 0.55],'LineWidth',3);
% fill(theta, r2, 'b', 'FaceAlpha', 0.3);
% fill(theta, r1, 'b', 'FaceAlpha', 0.3,'EdgeColor',[0.5 0.2 0.55],'LineWidth',3);
% 添加标签和标题
text(theta(1), r1(1), '变量1', 'FontSize', 12);
text(theta(2), r1(2), '变量2', 'FontSize', 12);
text(theta(3), r1(3), '变量3', 'FontSize', 12);
text(theta(4), r1(4), '变量4', 'FontSize', 12);
text(theta(5), r1(5), '变量5', 'FontSize', 12);
title('雷达图示例', 'FontSize', 14);
% 添加图例
legend('数据组1', '数据组2', 'Location', 'Best');
% 设置坐标轴
set(gca, 'ThetaTick', [0, 45, 90, 135, 180, 225, 270, 315], 'ThetaTickLabel', {'0', '45', '90', '135', '180', '225', '270', '315'}, 'RGridLineStyle', '-', 'RMinorGridLineStyle', '-', 'RGridColor', 'k', 'RMinorGridColor', 'k', 'GridColor', 'k');
% 添加网格线
grid on;
% 释放 hold
hold off;