MATLAB绘图功能演示

1、例子代码

clear all
%准备数据
x = 0:0.01:3*pi;
y1 = cos(x);
y2 = sin(x);
y3 = cos(3*x);
%设置当前绘图区
figure;
%绘图
plot(x,y1,x,y2,x,y3);
%设置坐标轴和网格线属性
axis([0 8 -2 2]); %限制显示时x,y坐标轴的范围
grid on;
%标注图形
xlabel('x');
ylabel('y');
legend('cos(x)','sin(x)','cos(3x)')

2、显示效果


猜你喜欢

转载自blog.csdn.net/su_bao/article/details/81002969
今日推荐