matlab函数作图
- plot(x1,y1,'s1',x2,y2,'s2',...xn,yn,'sn')
x、y为长度相同向量,s表示线型和颜色
>> x=0:0.1:2*pi;
>> y1=sin(x);>> y2=cos(x)
>> plot(x,y1,'r',x,y2,'b');
- subplot(m,n,k)
多窗口作图,将窗口分为m×n个子窗口,当前图在第k个窗口完成。
>> x=0:0.1:2*pi;
>> y1=sin(x);subplot(2,2,1); plot(x,y1);title('y=sin(x)');grid on%设置标题,打开格网
- hist直方图作图
count=hist(X)
count=hist(X,center)
count=hist(X,number)
[count,center]=hist(X)
>> X=normrnd(10,5,1000,1);
>> z=hist(X)
z =
4 27 88 190 270 243 123 38 13 4>> X=normrnd(10,5,1000,1);
>> [count,center]=hist(X);
>> bar(center,count); - grid二维图形绘制命令
grid on
grid off