如何MATLAB设置多条曲线的线宽??

一幅图上画多条线,且希望指明每条线的线宽,使用类似plot(x,y,'LineWidth',1)的命令,竟然不行,如plot(x,y,'LineWidth',1,x,z,'LineWidth',2),报错如下:
??? Error using ==> plot
String argument is an unknown option.
不得已,我用比较笨的方法,画完再调整线宽:
set(findobj(get(gca,'Children'),'Color','b'),'LineWidth',0.5);
set(findobj(get(gca,'Children'),'Color','g'),'LineWidth',1);
set(findobj(get(gca,'Children'),'Color','r'),'LineWidth',1.5);
set(findobj(get(gca,'Children'),'Color','m'),'LineWidth',2);
个人觉得这个方法不如前者方便,是我参数使用不当,还是MATALB不能这样用?
求高手指点!

Matlab画图设置多条线宽有以下两种方法。

    plot

    plot(x轴,y轴,'linewidth',线宽值);

    例子:

    x=0:1:450; y=0:2:900; m=0:1:100;n=0:3:300;

    plot(x,y,'linewidth',2); hold on; plot(m,n,'linewidth',3);

    set

    set(gca,'linewidth', 线宽值);

    例子:

    x=0:1:450; y=0:2:900; m=0:1:100; n=0:3:300;

    plot(x,y); set(gca,'linewidth',2);

    hold on; plot(m,n); set(gca,'linewidth',3);

plot是绘制二维图形的最基本函数,它是针对向量或矩阵的列来绘制曲线的。通过添加参数,可使用plot对图形进行颜色、线宽、marker等的设置。plot函数的调用格式为:

plot(x轴,y轴,属性名1,属性值1,属性名2,属性值2,…);

set是matlab中对象属性的操作函数,使用set可对其属性进行设置。set函数的调用格式为:set(句柄,属性名1,属性值1,属性名2,属性值2,…);

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-09-16
plot命令中可以画多条线,但是不能分别设置线宽。本回答被提问者采纳
第2个回答  2011-01-22
zn=conv(xn,yn)
xn=deconv(zn.yn)
主要的语句就是这两句
相似回答