zoukankan      html  css  js  c++  java
  • 关于在写第一个模式识别大作业中遇到的几个问题的总结

    一、MATLAB画图的积几点收获

    1、隐函数的绘制

      (1)使用ezplot函数

    1     syms r_hei r_wei;
    2     z = ( male_miu - female_miu )' * total_cov_inv * [r_hei; r_wei] + 1/2 * (  female_miu' * total_cov_inv * female_miu - male_miu' * total_cov_inv * male_miu ) + log(  male_previous_poss / female_previous_poss );
    3     ezplot( z, [140, 200, 30, 125] )%限制x、y轴显示的范围

    emmm上面的代码是从我的工程上摘出来的,简单的用法的话如下

    1   syms x y
    2   z=x+y;
    3   ezplot(z)
    1      fh = @(x,y) x.^2 + y.^3-2*y-1;%函数句柄的概念
    2      ezplot(fh)
    3      axis equal
    1 ezplot('x^2-y^2’) %这当然是最简单的用法啦

    MATLAB的官方给出来的用法有如下

    ezplot(fun)
    ezplot(fun,[xmin,xmax])
    ezplot(fun2)
    ezplot(fun2,[xymin,xymax])
    ezplot(fun2,[xmin,xmax,ymin,ymax])
    ezplot(funx,funy)
    ezplot(funx,funy,[tmin,tmax])
    ezplot(...,fig)
    ezplot(ax,...)
    h = ezplot(...)

      (2)

    1     syms r_hei r_wei;%[r_hei, r_wei] [r_hei; r_wei]
    2     myfun = @(r_hei, r_wei) [r_hei, r_wei] * W_male * [r_hei; r_wei] + w_male' * [r_hei; r_wei] + w0_male - ( [r_hei, r_wei] * W_female * [r_hei; r_wei] + w_female' * [r_hei; r_wei] + w0_female );  
    3     for r_hei = 150 : 0.5 : 200
    4         fun  = @(r_wei) myfun(r_hei, r_wei);
    5         r_wei= fzero(fun, 100);
    6         plot( r_hei, r_wei, 'ko');
    7     end       
    8   

    emmmm具体原理还不是很懂,但是知道这么写就能达到想要的效果。

    以后待补充吧!

    2、plot函数的一些细节用法

    https://blog.csdn.net/houshaolin/article/details/73017315

    这篇博文可以参考

    等有时间来把这部分好好整理一下。

    二、如何测试某段代码的执行时间

    1、在该段代码前加上tic,后加上toc

  • 相关阅读:
    KMP
    Trie 树
    Miller-Rabin质数测试
    快速幂
    Matlab 对图片的二值化处理
    huffman tree
    hdu5512-Pagodas
    迷宫
    poj2488-A Knight's Journey【DFS】
    linux操作
  • 原文地址:https://www.cnblogs.com/dadidelearning/p/9742615.html
Copyright © 2011-2022 走看看