Example 1 : Draw a sinusoidal image, and then display different curves, colors, and data point types
%使用曲线的色彩、线型和数据点型
%eg1:绘制不同范围内的正弦函数,演示不同线型、色彩和数据点型的使用
clear
t = 0:pi/20:pi;
plot(t,sin(t),'--rp') %双划线、红色、五角星符
hold on %附加图像
plot(t,sin(t-pi/2),'-.mo') %点划线、品红色、空心圆圈
plot(t,sin(t-pi),':bs') %虚线、蓝色、方块符
hold off
The hold on here was introduced in the previous article and is used to attach images. The results of the operation are as follows:
Example 2 : Draw a sinusoidal image and make more detailed adjustments to the properties of the curve, as follows:
Set thickness, data point size, fill color, etc.
%另外还可以对所画曲线的属性进行设置
figure %首先生成新的绘图窗口
plot(t,sin(2*t),'-mo',...
'LineWidth',2,... %设置曲线的粗细
'MarkerEdgeColor','k',... %设置数据点边界颜色
'MarkerFaceColor',[.49 1 .63],... %设置填充颜色
'MarkerSize',12) %设置数据点大小
Note: The specific parameters are adjusted as follows