在coursera上斯坦福的machine learning,lecturer极力推荐开源的编程环境Octave入手,所以我也下载了来试一试吧==

参考链接:http://www.linuxdiyf.com/linux/22034.html


安装(Ubuntu16.04):我看了下官网,Ubuntu上已经更新到4.0.3了,不过还是选了stable的,这里应该是4.0.2

$ sudo apt-add-repository ppa:octave/stable
$ sudo apt-get update
$ sudo apt-get install octave


运行octave:有图形界面 $ sudo octave

或者使用命令行来运行:$ sudo octave-cli


Octave和Matlab的主要区别:
1、费用方面
Octave是完全免费的(并且是开源的),而Matlab是商业软件
2、占用空间
Octave比较小,安装程序只有几十兆;Matlab庞大,是因为有大量的面向各种应用领域的工具箱,Octave无法相比的。
3、语法方面
Octave最初便是模彷Matlab而设计,语法基本上与Matlab一致,严谨编写的代码应同时可在Matlab及Octave运行,但也有很多细节上差别。
所以真的要写可以在matlab上运行的octave的话,需要考虑兼容性。
4、绘图方面
Octave的画图后台是强大的Gnuplot,有人认为绝对不会弱于Matlab,而且输出格式要远多于Matlab,公式显示也要强大很多。但也有人说Octave绘图速度比Matlab慢。
5、用户界面
Octave的GUI才刚开始有,可能弱一些。


Octave操作

% one row
x1 = [1, 3, 2]
% three row
x2 = [1; 3; 2]
% complex matrix should use .' for transposition
A.'
% A and B are matrix. Element-wise.
% .* ./ .^
A ./ B
a = 5
% Cij = a^Bij
C = a .^ B
% Moreover, we can also calculate row-wise multiply or division:
a = [1 2 3; 4 5 6; 7 8 9]
b = [10; 11; 12]
c = b.*a
d = a./b

index:

和Matlab一样,下标从1开始。

x = [1.2, 5, 7.6, 3, 8]
x(2)
% use index list
x([1, 3, 4])
A = [1, 2, 3; 4, 5, 6; 7, 8, 9]
% 1st and 3rd rows and 2nd and 3rd cols
A([1, 3], [2, 3])
% : means all elements
A(2, :)

range:

% start:step:stop
% default step is 1
1:3:10
% end means last element in the row or col. For vector and matrix
% last col of A showing
A(:, end)

special matrix:

x = [1,2,3;4,5,6;7,8,9]
% lower triangular part of x. Diagonal included.
tril(x)
% upper triangular part of x. Diagonal included.
triu(x)
% indentity matrix. eye(m, n) for m*n. filled by '0'
eye(n)
ones(m, n)
zeros(m, n)
% elements are in [0,1). uniformly drawn
rand(m, n)
% normaly distributed. negative is ok
randn(m, n)
% return a random permutation which is a row vector
randperm(n)
v = [1,2,3]
% diagonal are from v. other places are '0'
diag(v)
% return a vector contain elements from diagnoal of x
diag(x) % n elements in [a, b]. avg. n, is optional with default value 100.
linspace(a, b, n)
% n elements in [10^a, 10^b]. n is optional with default value of 50
logspace(a, b, n)

% left-right exchange
fliplr(x)
% up and down exchange
flipud(x)
% returns a copy of matrix A that has been rotated by (90n)° counterclockwise
rot90(x, n)
% sort and in increasing order
sort(x)
% rearrange x to m*n matrix. Selection start from x11 to xm1, then x21 to xm2....
reshape(x, 2, 6)

  

  

  

  

octave-basic的更多相关文章

  1. CheeseZH: Octave basic commands

    1.Basic Operations 5+6 3-2 5*8 1/2 2^6 1 == 2 %false ans = 0 1 ~= 2 %true ans = 1 1 && 0 %AN ...

  2. Octave入门

    Octave/Matlab Tutorial Octave/Matlab Tutorial Basic Operations 你现在已经掌握不少机器学习知识了 在这段视频中 我将教你一种编程语言 Oc ...

  3. 【原】Coursera—Andrew Ng机器学习—课程笔记 Lecture 5 Octave Tutorial

    Lecture 5 Octave教程 5.1 基本操作 Basic Operations 5.2 移动数据 Moving Data Around 5.3 计算数据 Computing on Data ...

  4. Octave教程

    Windows安装Octave http://wiki.octave.org/Octave_for_Microsoft_Windows 基本操作(Basic Operations) octave:1& ...

  5. Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结

    Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...

  6. Basic Tutorials of Redis(9) -First Edition RedisHelper

    After learning the basic opreation of Redis,we should take some time to summarize the usage. And I w ...

  7. Basic Tutorials of Redis(8) -Transaction

    Data play an important part in our project,how can we ensure correctness of the data and prevent the ...

  8. Basic Tutorials of Redis(7) -Publish and Subscribe

    This post is mainly about the publishment and subscription in Redis.I think you may subscribe some o ...

  9. Basic Tutorials of Redis(6) - List

    Redis's List is different from C#'s List,but similar with C#'s LinkedList.Sometimes I confuse with t ...

  10. Basic Tutorials of Redis(5) - Sorted Set

    The last post is mainly about the unsorted set,in this post I will show you the sorted set playing a ...

随机推荐

  1. (转)linux下控制帐户过期的多种方法

    linux下控制帐户过期的方法:原文:http://blog.51cto.com/oldboy/1289144企业里一般给无人管理的角色账户或开发人员临时需求等可以设定账户有效期,提升安全!法一:添加 ...

  2. Fleet-运行一个高可用的服务

    运行一个高可用的服务 使用CoreOS最大的好处就是你可以以高可用的方式来运行你的服务.接下来我们将部署两个一样的Apache web server容器.然后,我们将通过让一台机器出现故障,fleet ...

  3. Java基础:(六)关键字

    一.final 数据: 声明数据为常量,可以是编译时常量,也可以是在运行时被初始化后不能被改变的常量. 对于基本类型,final使数值不变: 对于引用类型,final使引用不变,也就不能引用其他对象, ...

  4. 【转】Maven项目中将配置文件打包到jar包中

    参考博客:http://blog.csdn.net/ciedecem/article/details/10382275 问题: 项目中需要用到从文件中加载json数据,如图放在conf目录下. 程序中 ...

  5. where whereis locate find 的用法

    1.where :where ifconfig.用来搜索命令,显示命令是否存在以及路径在哪 2.whereis:whereis vim .用来搜索程序名,而且只搜索二进制文件(参数-b).man说明文 ...

  6. spring boot + spring data jpa

    Spring Data Repository的核心接口是Repository(好像也没什么好惊讶的).这个接口需要领域类(Domain Class)跟领域类的ID类型作为参数.这个接口主要是让你能知道 ...

  7. intelliJ idea 激活和配置

    1. 双击打开 Intellij IDEA 桌面快捷方式图标,如下图: 2. 点击 ok 按钮,进入激活页面: 3. 他提供的三种方式激活:账号激活,激活码激活,服务器地址激活,我们选择激活码激活,去 ...

  8. css3实现钟表效果

    利用css3 transform属性刻画钟表的的刻度以及指针的角度,代码如下: <head> <meta charset="UTF-8"> <titl ...

  9. jquery 一键复制到剪切板

    今天做项目有一个功能,通过点击事件复制一段文本到剪切板,在网上找了一些,整理了一下,方便需要的朋友使用. <a id="copy" data-text="12345 ...

  10. 两个页面实现mui轮播图与选项卡结合

    index.html页面 <!DOCTYPE html><html><head> <meta charset="utf-8"> &l ...