zoukankan      html  css  js  c++  java
  • [Machine Learning] Octave Basic Operations

    You can do baisc math:

    5+6
    32-8
    1/2
    2^3
    1 == 2 % ans = 0 means false
    1 ~=1 % 1 not equals to 2. ans = 1 means true
    1 && 0
    1 || 0
    xor(1, 0)

    Change the output:

    PS1('>> ')

    Semicolon: 

    If you don't use semicolon, it prints the output, if you add semicolon, it doesn't print output:

    disp(a): print value:

    a=pi;
    disp(sprintf('2 decimals: %0.2f', a)) # 2 decimals: 3.14

    Format:

    Matrix / Vector:

    Step increasment:

    v = 1:0.2:2 # a row vector start from 1, each element increase by 0.2 until 2

    if step is 1:

    v = 1:6 # from 1 to 6

    2by3 matrix with all 1:

    ones(2,3)
    
    """
    ans =
    
       1   1   1
       1   1   1
    
    """
    c = 2*ones(2,3)
    """

    c =

       2   2   2

       2   2   2

    """
    w = zeros(1,3) 
    w= rand(3,3) # uniform distribution between zero and one.
    w = randn(3,3) # Gaussian distribution with mean zero and variance or standard deviation equal to one

    More complex matrix:

    w = -6 + sqrt(10)*(randn(1, 10000));
    hist(w)
    hist(w, 50)

  • 相关阅读:
    Spring IoC
    Java软件安装
    Struts(一)
    Struts(二)
    Hibernate(六)
    Hibernate(五)
    Hibernate(二)
    Hibernate(四)
    Hibernate(三)
    Hibernate(一)
  • 原文地址:https://www.cnblogs.com/Answer1215/p/13519878.html
Copyright © 2011-2022 走看看