zoukankan      html  css  js  c++  java
  • matlab使用

    1:cftool 调用拟合工具箱

    2:  matlab读取excel中的数据

    2.1、在Excel中输入数据,保存文件到Matlab的工作目录下,例如 test.xlsx

    2.2、在matlab命令窗口输入以下代码:

    >> data = xlsread('test.xlsx'); % 读入excel数据
    >> plot(data(1,:),data(2,:)); % 以第一行为x数据,第二行为y数据作图
    3:matlab 括号的 使用https://blog.csdn.net/pipisorry/article/details/39215767
    {} 大括号赋值语句:b{4}=[4];
    4:

    画图形中的小圆圈用plot都可以搞定。

     plot(imp(:,1),imp(:,2),'ro'); %最后的‘ro’,r是代表红色,o是代表画圈。画圈的话可以提供多个点的坐标,我这里用的就是向量的形式。
     

    plot(imp(1:2,1),imp(1:2,2)); %划线 提供两个xy坐标,然后plot默认就会划线
     plot(imp(3:5,1),imp(3:5,2));
     plot(imp(6:8,1),imp(6:8,2));
     plot(imp(9:11,1),imp(9:11,2));
     plot(imp(12:14,1),imp(12:14,2));

    5:为图片添加坐标轴和title.

    %阵元分布图
    figure
    plot(allElementPoint{1},allElementPoint{2},'ro');
    xlabel('x(λ)');
    ylabel('y(λ)');

    zlabel('z(z)');
    title('XLamda YLamda title');

    6: text中使用变量,为图片添加说明

    例如

    n=12.34;
    plot([0 2],[0 2]);
    text(1,1,sprintf('abcd=%0.4f',n))

    当element_sum是变量时,使用

    text(3,4,sprintf('阵元个数: %0.2f',element_sum));

     7:  matlab提高数值的精度

    使用format long

    >> format long
    >> pi
    
    ans =
    
       3.141592653589793

     缩小精度:format short

    8: matlab 放大缩小图片

    https://zhidao.baidu.com/question/139946719.html

    set (gcf,'Position',[100,100,350,280], 'color','w')           前两个指定 图片显示的中心点,后两个指定宽和高。

    9: matlab 设置变量

    https://wenku.baidu.com/view/49bc08cb0508763231121215.html

    http://www.mohu.org/info/symbols/symbols.htm

    10: matlab 画图设置字体。设置成time new roman , 然后再斜体,将会将符号变为变量。

    xlabel('u=sin heta cos φ','Fontname', 'Times New Roman','fontsize',figure_FontSize);

    11: 设置 xlabel中 字体在图中的位置。

    http://blog.sina.com.cn/s/blog_7e6270010101nt0r.html

    pos=axis;

    xlabel('{itu}=sin heta cos φ','Fontname', 'Times New Roman','fontsize','position',[pos(2) 1.15*pos(3)]);  % 设置坐标轴位置

    'FontWeight','bold'   给字体加粗。

  • 相关阅读:
    Comet OJ
    Comet OJ
    Comet OJ
    Comet OJ
    Codeforces Round #562 (Div. 2)
    P1202 USACO1.1 黑色星期五
    P1201 USACO1.1 贪婪的送礼者
    【线段树】HDU1166:敌兵布阵
    标准C++中的string类的用法总结(转)
    【递归】分形
  • 原文地址:https://www.cnblogs.com/liyafei/p/8641520.html
Copyright © 2011-2022 走看看