在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. NETCORE MVC模块化

    NETCORE MVC模块化 ASP.NETCORE MVC模块化编程 前言 记得上一篇博客中跟大家分享的是基于ASP.NETMVC5,实际也就是基于NETFRAMEWORK平台实现的这么一个轻量级插 ...

  2. Linux+.NetCore+Nginx

    Linux+.NetCore+Nginx搭建集群 本篇和大家分享的是Linux+NetCore+Nginx搭建负载集群,对于netcore2.0发布后,我一直在看官网的文档并学习,关注有哪些新增的东西 ...

  3. SpringBoot---Web开发---Tomcat配置

  4. Web.config文件 详解

    一.认识Web.config文件Web.config 文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式), ...

  5. 超文本传输协议(HTTP)

    超文本传输协议(HyperText Transfer Protocol,Http)是从服务器传输数据到客户端的传输协议. HTTP协议的主要特点可概括如下: 1.支持客户/服务器模式. 2.简单快速: ...

  6. 洛谷CF784E Twisted Circuit

    (本题本来可能也就普及难度但是硬生生给评成了一道NOI难度的紫题,有点无语...) 这道题目是一道愚人节题目,本来只有下面的电路图,结果翻译完之后难度就直接没了. ------------ 言归正传, ...

  7. web标准、可用性、可访问性

    前言:大家不难发现,只要是招聘UED相关的岗位,如前端开发工程师.交互设计师.用户研究员甚至视觉设计师,一般都对web标准.可用性和可访问性的理解有要求.那么到底什么是web标准.可用性.可访问性呢? ...

  8. android 代码将数据库文件导出到sd卡

    public static void save() { String dbpath = "/data/data/tl.cac.view/databases/" +"afi ...

  9. Linux shell标准输入,标准输出,错误输出

    shell中可能经常能看到:1>/dev/null  2>&1  eg:sudo kill -9 `ps -elf |grep -v grep|grep $1|awk '{prin ...

  10. UML的九种模型图

    本文转自UML 的九种模型图,仅供学习交流! 一.作为一种建模语言,UML的定义包括UML语义和UML表示法两个部分. UML语义:描述基于UML的精确元模型定义. UML表示法:定义UML符号的表示 ...