OCTAVE 's usage

In andrew's class , he talked about a software called octave. Its grammar is similar to  matlab.Here are some examples on how to use it.
(1)Load data

In order to load the data into a matrix . First you should cd to the target directory. Then use "load xxx.mat"command xxx is the name of your file. After loading , there will be a matrix called xxx.

(2)Index 
A is defined as a matrix.  A(i,:) returns the ith row vector. A(:,j) returns the jth colunmn vector. A(:) returns a column vector For example 

(3)matrix Espansion

For example:

(4)Search 

For example ,find elements which are larger than 12

data(2,1) data(1,2) data(2,2) those elements are larger than 12 . r stands for rows , c stands for columns

How to find the max value of columns or rows 

(6)Plot data

we use hold on command to plot one figure on top of  other figures.
we use subplot(rows,cols,number) command to plot several figure into one window . Rows,cols mean how many rows and columns in this window . number means which  one you want to plot.

we use imagesc(matrix name),colorbar ,colormap gray commands to visualize the matrix.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值