41.重绘曲线
Exam:重绘波形y=sin(t)sin(9t)及其包络线。
>> plot(t,y1,'r:')
>> hold on
>> plot(t,y2,'b')
>> plot(t3,y3,'bo')
>> axis([0,pi,-1,1])
>> hold off
42.利用hold绘制离散信号的波形
>> t=2*pi*(0:20)/20;
>> y=cos(t).*exp(-0.4*t);
>> stem(t,y,'g');
>> hold on
>> stairs(t,y,'r');
>> hold off
43.双纵坐标:plotyy指令
调用格式:plotyy(x1,y1,x2,y2),x1-y1曲线y轴在左,x2-y2曲线y轴在右
>> x=0:0.01:20;
>> y1=200*exp(-0.05*x).*sin(x);
>> y2=0.8*exp(-0.5*x).*sin(10*x);
>> plotyy(x,y1,x,y2);
44.多子图
subplot(m,n,k):使(m*n)幅子图中第k个子图成为当前图;其编号原则:左上方为第1子图,然后向右向下一次排序。
subplot('position',[left,bottom,width,height]):在指定的位置上开辟子图,并成为当前图;用于手工指定子图位置,指定位置的四元组采
用归一化的标称单位,即认为整个图形窗口绘图区域的高、宽的取值范围都是[0,1],而左下角为(0,0)坐标。
>> t=(pi*(0:1000)/1000)';
>> y1=sin(t);
>> y2=sin(10*t);
>> y12=sin(t).*sin(10*t);
>> subplot(2,2,1);
>> subplot(2,2,1),plot(t,y1);
>> axis([0,pi,-1,1])
>> subplot(2,2,2),plot(t,y2);
>> axis([0,pi,-1,1])
>> subplot('position',[0.2,0.2,0.2,0.2]),plot(t,y12);
45.绘制图形的辅助操作
>> t=(0:15)*2*pi/15;
>> y=sin(t);
>> subplot(3,2,1),plot(t,y);title('Lins style is default')%默认
>> subplot(3,2,2),plot(t,y,'o');title('Lins style is o')%圆圈
>> subplot(3,2,3),plot(t,y,'k:');title('Lins style is k:')%黑虚线
>> subplot(3,2,4),plot(t,y,'k:*');title('Lins style is k:*')%黑虚线八线符
>> subplot(3,2,5),plot(t,y,'m-d');title('Lins style is m-d')%品红实线菱形符
>> subplot(3,2,6),plot(t,y,'r-p');title('Lins style is r-p')%红实线五角星符
标签:subplot,plot,Lins,基础,matlab,y1,操作,y2,sin From: https://blog.csdn.net/wodertianna/article/details/141144664