octave-basic
在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的更多相关文章
- 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 ...
- Octave入门
Octave/Matlab Tutorial Octave/Matlab Tutorial Basic Operations 你现在已经掌握不少机器学习知识了 在这段视频中 我将教你一种编程语言 Oc ...
- 【原】Coursera—Andrew Ng机器学习—课程笔记 Lecture 5 Octave Tutorial
Lecture 5 Octave教程 5.1 基本操作 Basic Operations 5.2 移动数据 Moving Data Around 5.3 计算数据 Computing on Data ...
- Octave教程
Windows安装Octave http://wiki.octave.org/Octave_for_Microsoft_Windows 基本操作(Basic Operations) octave:1& ...
- Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结
Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Net Core下通过Proxy 模式
Net Core下通过Proxy 模式 NET Core下的WCF客户端也是开源的,这次发布.NET Core 2.0,同时也发布了 WCF for .NET Core 2.0.0, 本文介绍在.NE ...
- 057 Insert Interval 插入区间
给出一个无重叠的按照区间起始端点排序的区间列表.在列表中插入一个新的区间,你要确保列表中的区间仍然有序且不重叠(如果有必要的话,可以合并区间).示例 1:给定区间 [1,3],[6,9],插入并合并 ...
- Error occurred while loading plugins. CLI functionality may be limited.
npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest @ionic/cli-plugin-cordova ...
- 洛谷P1781 宇宙总统
https://www.luogu.org/problem/show?pid=1781 高精比较大小: #include<iostream> #include<cstdio> ...
- Json 后台转对象的方式或者获取属性值方式。
类似这类的 json字符串 后台转成 model 或者取其中一个属性值. 需要去掉前后引号 以及将转义字符去掉.空格代替 resoult = resoult.Substring(0, resoult. ...
- NIO学习之Channel
一.Channel基础 通道是一个对象,通过它可以读取和写入数据,Channel就是通向什么的道路,为数据的流向提供渠道: 在传统IO中,我们要读取一个文件中的内容使用Inputstream,该str ...
- php 根据周数获取当周的开始日期与最后日期
/** * 根据第几周获取当周的开始日期与最后日期 * @param int $year 年份 $weeks = get_week($year) * @param 如获取第18周的开始日期$weeks ...
- 卡了很久的bug
背景:在一个简单的项目中,通过循环前端传来的一个数组,使用mongodb条件查询数据,将满足条件的数据push进一个新数组,并返回至前端. 问题:每次调试到第五行,会自动跳过,直接执行12行,打印出来 ...
- MapReduce的过程(2)
MapReduce的编程思想(1) MapReduce的过程(2) 1. MapReduce从输入到输出 一个MapReduce的作业经过了input.map.combine.reduce.outpu ...
- 初识Adapter
首先得了解Adapter层级关系: 示例,将user对象适配到textview public class User { private String userName; private String ...