题目:(2) 根据下面图形写出作图语句
① y=sinxy=cosx 在同一幅图;
②y=sinxy=cosx 在同一幅图不同窗口
1.
figure(1);
% ① y=sinx,y=cosx 在同一幅图;
x = -2*pi:0.1:2*pi;
y =sin(x);
plot(x,y);
legend('cos(x)', 'location','best');
hold on
y = cos(x);
plot(x,y);
legend('sin(x)','cos(x)', 'location','best');
2.
figure(1);
x = -2*pi:0.1:2*pi;
y = sin(x);
plot(x,y);
legend('sin(x)','location','best');
figure(2)
y = cos(x);
plot(x,y);
legend('cos(x)','location','best');
drawnow
clear all
clc