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 调试总结 张朋艺

  • 相关阅读:
    看起来像一个输入框的input,实际上是有两个input
    Actions类的一些主要方法
    selenium通过WebDriverWait实现ajax测试,实现等页面元素加载完成
    如何判断新打开窗口是否需要切换
    鼠标悬停
    Selenium WebDriver使用IE浏览器
    Element should have been select but was input
    58同城Java面试
    2个线程ABAB或者BABA循环输出
    使多个线程循环输出099099
  • 原文地址:https://www.cnblogs.com/huty/p/8518950.html
Copyright © 2011-2022 走看看