example.m

来自「基础程序」· M 代码 · 共 31 行

M
31
字号
% example.m
% 绘制图形示例
x1=-17:1:3;
y1=1./((x1+3).^2+1)+1./((x1+9).^2+4)+5;
x2=-17:0.02:3;
y2=1./((x2+3).^2+1)+1./((x2+9).^2+4)+5;
% 绘制图形比较
subplot(2,2,1);
plot(x1,y1,'rp');
axis([-17 3 5 6.5]);
title('figure 1');
grid on;

subplot(2,2,2);
plot(x2,y2,'rp');
axis([-17 3 5 6.5]);
title('figure 2');
grid on;

subplot(2,2,3);
plot(x1,y1,x1,y1,'rp');
axis([-17 3 5 6.5]);
title('figure 3');
grid on;

subplot(2,2,4);
plot(x2,y2,'LineWidth',2);
axis([-17 3 5 6.5]);
title('figure 4');
grid on;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?