matlab中向量norm,【Matlab开发】matlab中norm范数以及向量点积、绘图设置相关
【Matlab開發(fā)】matlab中norm范數(shù)以及向量點積、繪圖設(shè)置相關(guān)
標(biāo)簽(空格分隔): 【Matlab開發(fā)】
聲明:引用請注明出處外鏈網(wǎng)址已屏蔽
norm范數(shù)使用
help norm
norm Matrix or vector norm.
norm(X,2) returns the 2-norm of X.
norm(X) is the same as norm(X,2).
norm(X,1) returns the 1-norm of X.
norm(X,Inf) returns the infinity norm of X.
norm(X,'fro') returns the Frobenius norm of X.
在對某一個數(shù)組進行normalization的時候用起來十分方便,直接 X/norm(X)即可。
向量點積
>> help dot
dot Vector dot product.
C = dot(A,B) returns the scalar product of the vectors A and B.
A and B must be vectors of the same length. When A and B are both
column vectors, dot(A,B) is the same as A'*B.
點積跟點乘的區(qū)別需要注意一下,點積得到的是乘加,點乘不相加。
繪圖設(shè)置相關(guān)
1.坐標(biāo)軸設(shè)置
范圍設(shè)置:
a. axis([xmin xmax ymin ymax])設(shè)置坐標(biāo)軸在指定的區(qū)間
b. axis auto 將當(dāng)前繪圖區(qū)的坐標(biāo)軸范圍設(shè)置為MATLAB自動調(diào)整的區(qū)間
c. axis manual 凍結(jié)當(dāng)前坐標(biāo)軸范圍,以后疊加繪圖都在當(dāng)前坐標(biāo)軸范圍內(nèi)顯示
d. axis tight 采用緊密模式設(shè)置當(dāng)前坐標(biāo)軸范圍,即以用戶數(shù)據(jù)范圍為坐標(biāo)軸范圍比例:
a. axis equal 等比例坐標(biāo)軸
b. axis square 以當(dāng)前坐標(biāo)軸范圍為基礎(chǔ),將坐標(biāo)軸區(qū)域調(diào)整為方格形
c. axis normal 自動調(diào)整縱橫軸比例,使當(dāng)前坐標(biāo)軸范圍內(nèi)的圖形顯示達(dá)到最佳效果
范圍選項和比例設(shè)置可以聯(lián)合使用,默認(rèn)的設(shè)置為axis auto normal
2.坐標(biāo)軸刻度設(shè)置
set(gca, ’XTick’, [0 1 2]) X坐標(biāo)軸刻度數(shù)據(jù)點位置
set(gca,’XTickLabel’,{‘a(chǎn)’,’b’,’c’}) X坐標(biāo)軸刻度處顯示的字符
set(gca,’FontName’,’Times New Roman’,’FontSize’,14)設(shè)置坐標(biāo)軸刻度字體名稱,大小
‘FontWeight’,’bold’ 加粗 ‘FontAngle’,’italic’ 斜體
對字體的設(shè)置也可以用在title, xlabel, ylabel等中
3.圖例
legend(‘a(chǎn)’,’Location’,’best’) 圖例位置放在最佳位置
4.設(shè)置曲線線寬、標(biāo)記點大小,標(biāo)記點邊框顏色和標(biāo)記點填充顏色等。
plot(…,’Property Name’, Property Value, …)
Property Name 意義 選項
LineWidth 線寬 數(shù)值,如0.5,1等,單位為points
MarkerEdgeColor 標(biāo)記點邊框線條顏色顏色字符,如’g’, ’b’等
MarkerFaceColor 標(biāo)記點內(nèi)部區(qū)域填充顏色顏色字符
MarkerSize 標(biāo)記點大小 數(shù)值,單位為points
a=linspace(1,2,10)
plot(a,'--pr','linewidth',1.5,'MarkerEdgeColor','r','MarkerFaceColor','m','MarkerSize',10)
legend('a','Location','best')
title('a','FontName','Times New Roman','FontWeight','Bold','FontSize',16)
xlabel('T','FontName','Times New Roman','FontSize',14)
ylabel('a','FontName','Times New Roman','FontSize',14,'Rotation',0)
axis auto equal
set(gca,'FontName','Times New Roman','FontSize',14)
2015-11-06 調(diào)試總結(jié) 張朋藝
總結(jié)
以上是生活随笔為你收集整理的matlab中向量norm,【Matlab开发】matlab中norm范数以及向量点积、绘图设置相关的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 内存烤机大揭秘:性能对比,外观惊艳,使用
- 下一篇: matlab人脸追踪,求大神帮助我这个菜