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 ...
随机推荐
- (转)mysqldump: Got error: 1556: You can't use locks with log tables.
mysqldump: Got error: 1556: You can't use locks with log tables. 原文:http://blog.51cto.com/oldboy/112 ...
- java类在eclipse上打jar包,Linux上成功运行的实例
1 eclipse下的java项目结构如下图所示: 2 打包的步骤如下: 3 修改minifest.mf文件: 4 .上传需要的三方jar包们和主类打的jar(案例是topV.jar)并且执行jav ...
- java实现xml文件读取并保存到对象
首先浅聊一下解析xml的四种方式: 1.DOM方式:有缺点但是这个缺点却也是他的优点.下面详细介绍: 以树形的层次结构组织节点或信息片断集合,可以获得同一个文档中的多处不同数据.使用起来简单. 优点是 ...
- webpack.config.js====entry入口文件的配置
1. 一般是采用对象语法: entry: { index: './src/default/js/index.js' }, https://webpack.css88.com/concepts/ent ...
- 报错:java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.xxx.entity.PersonEntity
报错:java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.xxx.entity.PersonEntity 代 ...
- B/S架构 C/S架构 SOA架构
一.什么是C/S和B/S 第一.什么是C/S结构.C/S (Client/Server)结构,即大家熟知的客户机和服务器结构.它是软件系统体系结构,通过它可以充分利用两端硬件环境的优势,将任务合理分配 ...
- windows下vue-cli及webpack 构建网站(一)环境安装
1.安装Node.js,node.js安装包及源码下载地址为:https://nodejs.org/en/download/. 2.安装npm,由于新版的nodejs已经集成了npm,所以之前npm也 ...
- linux系统基本结构-《循序渐进linux》
1.linux控制台 linux系统由桌面控制台(X -Window视窗)和字符控制台组成.字符控制台是linux的核心,默认linux下有6个字符控制台. 字符控制台--〉X-Window下:ctr ...
- Android studio 3.1.1 找不到DDMS
先找到AndroidStudio配置的SDK路径: 在SDK的/tools/路径下[就是和配置ADB一样的路径]有个monitor.bat 的批处理文件: 鼠标连续点击两下monitor.bat这个批 ...
- /pentest/enumeration/irpas/itrace
/pentest/enumeration/irpas/itrace 追踪防火墙内部路由