1.繪製垂直直方圖
clear all;
bar(rand(1,10))
2.繪製矩陣直方圖
clear;
%bar(rand(1,10))
x=-2:0.1:2;
y=exp(-x.*x);
bar(x,y)
3.用area函數根據矢量或者矩陣的列產生一個區域圖
clear;
X=magic(6);
area(X);
4.利用errorbar函數來表示已知資料的誤差值
詳解:http://blog.sina.com.cn/s/blog_66d362d70102v4i5.html
clear;
x=linspace(0,2*pi,30);
y=cos(x);
e=std(y)*ones(size(x));
errorbar(x,y,e);
5.利用rose將資料大小視爲角度,資料個數視爲距離,並採用極座標表示
詳解:https://ww2.mathworks.cn/help/matlab/ref/rose.html
clear;
x=randn(1000,1);
rose(x);
6.利用stairs畫出階級圖
詳解:https://ww2.mathworks.cn/help/matlab/ref/stairs.html?s_tid=doc_ta
clear;
x=linspace(0,10,50);
y=cos(x).*exp(-x/3);
stairs(x,y);
7.利用stem函數繪製數位信號針狀圖
詳解:https://ww2.mathworks.cn/help/matlab/ref/stem.html?s_tid=doc_ta
clear;
x=linspace(0,10,50);
y=cos(x).*exp(-x/3);
stem(x,y);
8.利用fill爲多邊形塗上顏色
詳解:https://ww2.mathworks.cn/help/matlab/ref/fill.html?searchHighlight=fill&s_tid=doc_srchtitle
clear;
x=linspace(0,10,50);
y=cos(x).*exp(-x/3);
fill(x,y,'b');
9.利用feather函數將每一個資料點視爲複數,並用箭頭畫出
詳解:https://ww2.mathworks.cn/help/matlab/ref/feather.html?s_tid=doc_ta
clear;
theta=linspace(0,2*pi,20);
z=sin(theta)+i*cos(theta);
feather(z);
10.利用compass函數作羅盤圖
詳解:https://ww2.mathworks.cn/help/matlab/ref/compass.html?s_tid=doc_ta
clear;
theta=linspace(0,2*pi,20);
z=sin(theta)+i*cos(theta);
compass(z);
11.利用scatter(X,Y,S,C)在向量X,Y定義的位置繪製彩色的圓圈標誌
詳解:https://ww2.mathworks.cn/help/matlab/ref/scatter.html?s_tid=doc_ta
clear;
load seamount;
scatter(x,y,7,z);
12.利用pie(X)函數,使用X中的數據繪製一張餅圖
詳解:https://ww2.mathworks.cn/help/matlab/ref/pie.html?s_tid=doc_ta
clear;
x=[4 3 8 2 1 7 5];
explode=[0 0 0 0 1 1 0];
pie(x,explode);