Matlab-多曲线画法和点标记

为了避免自己忘记,写个笔记吧。

先上效果图:

Matlab-多曲线画法和点标记_第1张图片

然后是代码,主要是为了自己不忘记,而且自己是新手,所以没有遵守代码规范,有问题评论问我吧。

clc;
x_1 = 0.01:0.01:0.99;
x_2 = 1.01:0.01:10.0;
note = ["a_{1}","a_{2}","a_{3}","a_{4}","a_{5}"];
C = linspecer(5);
hold on;
h1 = plot(x_1 ,y(1:99,1), x_2, y(100:999,1),'-','color',C(1,:),'LineWidth',2);
h2 = plot(x_1 ,y(1:99,2), x_2, y(100:999,2),'-','color',C(2,:),'LineWidth',2);
h3 = plot(x_1 ,y(1:99,3), x_2, y(100:999,3),'-','color',C(3,:),'LineWidth',2);
h4 = plot(x_1 ,y(1:99,4), x_2, y(100:999,4),'-','color',C(4,:),'LineWidth',2);
h5 = plot(x_1 ,y(1:99,5), x_2, y(100:999,5),'-','color',C(5,:),'LineWidth',2);
%设置标记点和标记文字
plot(2.31, 0.55936, "r.", "MarkerSize",12);
text(2.31, 0.54000, "(2.31, 0.55936)");
plot(0.34, 0.4117, "r.", "MarkerSize",12);
text(0.51, 0.42, "(0.34, 0.4117)");
%设置图例
legend([h1(1,1),h2(1,1), h3(1,1), h4(1,1), h5(1,1)], "a_1","a_2","a_3","a_4","a_5", 'fontsize', 12);
set(gca, 'XLim', [0,10]);
ylabel('\Delta','Fontname','微软雅黑','fontsize',12,'rotation',0);%x轴标记
xlabel('\alpha','Fontname','微软雅黑','fontsize',12);%y轴标记
grid on;

 

你可能感兴趣的:(常用)