matlab基础操作(七)

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')%红实线五角星符

 

  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值