x=0:0.01:2*pi;
y=sin(x);
plot(x,y)
xlabel('正弦函数')
效果:

多行
xlabel({'正弦函数','sin'})
特殊字符
xlabel({'正弦函数','sin','-2\pi \leq x \leq 2\pi'})

改变大小及加粗
xlabel({'正弦函数','sin','-2\pi \leq x \leq 2\pi'},'FontSize',12,'FontWeight','bold')

改变字体及颜色
xlabel({'正弦函数','sin','-2\pi \leq x \leq 2\pi'}, 'FontSize',12,'FontWeight','bold','color','r','Fontname','STFangSong')

subplot()
x=0:0.01:2*pi;
y=sin(x);
subplot(2,3,1)
plot(x,y)
xlabel('正弦函数')
subplot(2,3,2)
plot(x,y)
xlabel({'正弦函数','sin'})
subplot(2,3,3)
plot(x,y)
xlabel({'正弦函数','sin','-2\pi \leq x \leq 2\pi'})
subplot(2,3,4)
plot(x,y)
xlabel({'正弦函数','sin','-2\pi \leq x \leq 2\pi'},'FontSize',12,'FontWeight','bold')
subplot(2,3,5)
plot(x,y)
xlabel({'正弦函数','sin','-2\pi \leq x \leq 2\pi'}, 'FontSize',12,'FontWeight','bold','color','r','Fontname','STFangSong')

参考:
https://jingyan.baidu.com/article/19020a0a600645529d284228.html
本文详细介绍使用Matlab进行绘图的各种技巧,包括如何设置坐标轴标签,如何使用特殊字符,如何调整字体大小和颜色,以及如何利用subplot进行子图布局。通过多个实例展示不同效果的实现方法。

874

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



