matlab绘图, 在4个图形窗口分别绘制sin(x),cos(x),tan(x),ctan(x)

2024-12-02 09:10:01
推荐回答(2个)
回答1:

x=0:pi/10:2*pi;
x2=[0+0.0001:pi/1000:2*pi]
y1=sin(x);
y2=cos(x);
y3=tan(x2);
y4=cot(x2);
subplot(2,2,1)
plot(x,y1);
axis([0,2*pi,-1.5,1.5])
subplot(2,2,2)
plot(x,y2);
axis([0,2*pi,-1.5,1.5])
subplot(2,2,3)
plot(x2,y3);
axis([0,2*pi,-50,50])
subplot(2,2,4)
plot(x2,y4);
axis([0,2*pi,-50,50])

回答2:

x=0:pi/10:2*pi;
x2=[0+0.0001:pi/1000:2*pi]
y1=sin(x);
y2=cos(x);
y3=tan(x2);
y4=cot(x2);

plot(x,y1);

hold on
plot(x,y2);

hold on
plot(x2,y3);

hold on
plot(x2,y4);
axis([0,2*pi,-10,10])