matlab x = linspace(0, pi); y1 = cos(x); plot(x, y1); hold on; y2 = cos(2*x); plot(x, y2, 'HandleVisibility', 'off'); % 这条线不会在图例中显示 y3 = cos(3*x); plot(x, y3); hold off; legend('first', 'third'); % 只显示'first'和'third'的图例 方法二:在legen...
1 下面给出实现的代码。figure;for i=1:m+n+k if i<=m hi(i)=plot(10*log10(Ptotal(i,:)),'-b','linewidth',2); if i~=1 set(hi(i),'handlevisibility','off'); end hold on; else hi(i)=plot(10*log10(Ptotal(i,:...
1 首先,我们创建六条曲线,分两次绘制曲线x = 0 : 0.01 : 4*pi;y1 = sin(x);y2 = cos(x);y3 = 3*cos(x);y4 = cos(x).*sin(x);y5 = cos(x) + sin(x);y6 = cos(x) - 2*sin(x);h1 = plot(x,y1,x,y2,x,y3);hold onh2 = plot(x,y4,x,y5,x,y6);2 画出来的...
第一种情况,一个plot绘制出的多条曲线 h = plot(x, profiles) %举例绘制了20条廓线 legend(h[1 8 10], 'profile 1', 'profile 8', 'profile 10'); %显示第1、8、10条廓线的legend 第二种情况,不同的plot函数绘制出来的曲线 h1 = plot(x1, y1); hold on; h2 = plot(x2, y2); hold on...
1. 画了很多条线,但是只想显示其中部分条线的图例的问题 画图直接用plot画的,想显示图例,但是加的其他scatter也出现在图例里面:像这样: t=0:0.1:10;y1=1*sin(t);y2=2*sin(t);y3=3*sin(t);figure;size=12;holdon;plot(t,y1)plot(t,y2)legend("y_1","y_2","Location","best",'FontName'...
代码如下: clc;clear;closeall;x1=[-50-40-30-20-1001020304050];y1=[-50-30-101030507090110130150];x2=-100:10:200;y2=(x2+100).^2/1000;% 画图figure;plot(x1,y1,'-*r','LineWidth',3);holdon;plot(x2,y2,'--b','LineWidth',2);holdoff;% 图的名字title('图的名字');% 图例legend(...
plot(X1,Y1,LineSpec1,…) hlod all plot(X2,Y2,LineSpec2,…) MATLAB中提供的线型属性 需要说明的是,LineSpec中设置曲线线型、标识符和颜色三项属性时,控制符的顺序不受限制并可以省略或者部分省略。也就是说’r-.*’、’-.r*’、’*-.r’等形式是等效的,都表示使用红色点划线连接各个节点,各节点使用“...
x=0:pi/20:2*pi;y1=sin(x);y2=cos(x);%绘制 sin 曲线,红色+圆圈+虚线%绘制 cos 曲线,绿色+三角+冒号线plot(x,y1,'--or',x,y2,'^g:');%按照顺序标识标识图形legend('sin(x)','cos(x)');%添加标题title('正弦/余弦函数');%添加 x 轴标签%\pi 在图像中显示的小写希腊字母xlabel('x ...
1.plot()函数 用于绘制平面上的线型坐标曲线 plot()函数参数xy一般为长度相等的向量。 (1)plot函数的基本用法 plot(x,y)其中x和y分别用于存储x坐标和y坐标数据。 (2)最简单的plot函数调用格式 plot(x)·当x为一个向量时,横坐标为x的下标,纵坐标为x向量元素的值。