Matlab论文作图

一个函数

x=[0:0.01:10];
y=sin(x);
plot(x,y),xlabel('x'),ylabel('sin(x)'),title('sin(x) graph');grid on;

Matlab论文作图_第1张图片

------------------------------------

多个函数

x=[0:0.01:1];
y1=x;
y2=x.*x;
plot(x,y1,x,y2),xlabel('x'),ylabel('y');grid on;

Matlab论文作图_第2张图片

--------------------------------------------------------

不同属性的点

x=1:1:7;
y=power(x,2);
color={'*r','*g','*b','*y','*m','*k','*c'};
for i=1:7
    hold on;
    plot(x(i),y(i),color{i});grid on;
end

Matlab论文作图_第3张图片

-----------------------------------------------------------------------

折线图

x=1:1:7;
y=power(x,2);
plot(x,y,'-o');grid on;

Matlab论文作图_第4张图片

-------------------------------------------------------------------

柱状图

y=[0.1666666,0.241379,0.466666;1.086957,1.647059,2.238095];
bar(y);

Matlab论文作图_第5张图片

------------------------------------------------------------

组合图

x1=1:1:7;
y1=power(x,2);

y2=[0.1666666,0.241379,0.466666;1.086957,1.647059,2.238095]

subplot(1,2,1);
plot(x1,y1,'-o');grid on;
subplot(1,2,2);
bar(y2);grid on;

Matlab论文作图_第6张图片

------------------------------------------------------------

黑白版面多折线图

Matlab论文作图_第7张图片

x=0:0.1:1
y1=x
y2=x.*x
y3=x.*x.*x
plot(x,y1,'h-');hold on
plot(x,y2,'s-.');hold on
plot(x,y3,'d--')
legend('y=x','y=x*x','y=x*x*x')

Matlab论文作图_第8张图片

你可能感兴趣的:(科研基础)