zoukankan      html  css  js  c++  java
  • 【Matlab开发】matlab中norm范数以及向量点积、绘图设置相关

    【Matlab开发】matlab中norm范数以及向量点积、绘图设置相关

    标签(空格分隔): 【Matlab开发】


    声明:引用请注明出处http://blog.csdn.net/lg1259156776/


    norm范数使用

    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.
    

    在对某一个数组进行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.
    

    点积跟点乘的区别需要注意一下,点积得到的是乘加,点乘不相加。

    绘图设置相关

    1.坐标轴设置
    范围设置:
    a. axis([xmin xmax ymin ymax])设置坐标轴在指定的区间
    b. axis auto 将当前绘图区的坐标轴范围设置为MATLAB自动调整的区间
    c. axis manual 冻结当前坐标轴范围,以后叠加绘图都在当前坐标轴范围内显示
    d. axis tight 采用紧密模式设置当前坐标轴范围,即以用户数据范围为坐标轴范围比例:
    a. axis equal 等比例坐标轴
    b. axis square 以当前坐标轴范围为基础,将坐标轴区域调整为方格形
    c. axis normal 自动调整纵横轴比例,使当前坐标轴范围内的图形显示达到最佳效果
    范围选项和比例设置可以联合使用,默认的设置为axis auto normal

    2.坐标轴刻度设置
    set(gca, ’XTick’, [0 1 2]) X坐标轴刻度数据点位置
    set(gca,’XTickLabel’,{‘a’,’b’,’c’}) X坐标轴刻度处显示的字符
    set(gca,’FontName’,’Times New Roman’,’FontSize’,14)设置坐标轴刻度字体名称,大小
    ‘FontWeight’,’bold’ 加粗 ‘FontAngle’,’italic’ 斜体
    对字体的设置也可以用在title, xlabel, ylabel等中

    3.图例
    legend(‘a’,’Location’,’best’) 图例位置放在最佳位置

    4.设置曲线线宽、标记点大小,标记点边框颜色和标记点填充颜色等
    plot(…,’Property Name’, Property Value, …)

    Property Name 意义 选项

    LineWidth 线宽 数值,如0.5,1等,单位为points
    MarkerEdgeColor 标记点边框线条颜色颜色字符,如’g’, ’b’等
    MarkerFaceColor 标记点内部区域填充颜色颜色字符
    MarkerSize 标记点大小 数值,单位为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 调试总结 张朋艺

  • 相关阅读:
    【构建二叉树】01根据前序和中序序列构造二叉树【Construct Binary Tree from Preorder and Inorder Traversal】
    PHP 语言需要避免的 10 大误区
    极客编程必备的五大PHP开发应用
    你听说过PHP 的面向方面编程吗?
    8个开发必备的PHP功能
    写给系统管理员的25个PHP安全实践
    PHP输出缓冲控制- Output Control 函数应用详解
    创建高安全性PHP网站的几个实用要点
    简化PHP开发的10个工具
    PHP文件下载原理
  • 原文地址:https://www.cnblogs.com/huty/p/8518951.html
Copyright © 2011-2022 走看看