octave基本命令

常用的加减乘除运算

5+6

ans = 11

...

%xxx 表示注释

逻辑运算中不等于是 ~=

矩阵

A = [1 2 3] 1*3的矩阵

B = [1,2;3,4;5,6] 3*2的矩阵

A(x,y)索引

size(A) : 返回的就是 1 3

size(B): 返回的就是 3 2

length(x):返回列、行中最大值

pwd:列出当前路径

cd '/xx/x': 切换目录

ls:列出当前目录所有文件

load xx :加载文件

who:当前所用到的变量

clear x:删除某个变量

clear:删除当前所有变量

save xxx  y;保存到文件y到xxx

eye(n):生成单位矩阵N*N

ones(N):生成全部为1的N*N的矩阵

A(:,2)第二列的所有内容

A(2,:)第二行的所有内容

A([1,3],:)第一、三行的所有内容

A(:) 将所有的值变成一个列向量,从第一列加到最后一列

A = 

1 2 100

3 4 101

5 6 102

A(:)

1

3

5

2

4

6

100

101

102

 

矩阵运算:A*B 矩阵相乘

A .* B :点乘

A.^2 : 平方运算

A': A的转置

magic:

octave:32> help magic
'magic' is a function from the file D:\Program\Octave-4.4.1\share\octave\4.4.1\m\special-matrix\magic.m

 -- magic (N)

     Create an N-by-N magic square.

     A magic square is an arrangement of the integers '1:n^2' such that
     the row sums, column sums, and diagonal sums are all equal to the
     same value.

     Note: N must be a scalar greater than or equal to 3.  If you supply
     N less than 3, magic returns either a nonmagic square, or else the
     degenerate magic squares 1 and [].

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

prop:相乘

max:第一个维度的最大值

计算对角矩阵的和

a = 

1 2 3

4 5 6

7 8 9

max(a*单位对角矩阵)

ans = sum(sum(a.*eye(3)));

plipud:矩阵行交换

plot(x,y) :画出y与x的函数

同时画出两个图像,hold on ,下一个绘图命令

legend显示直线标记

title:标记

print -dpng 'xxxx.png' 打印文件到当前的路径

subplot(x,y,index):划分为(x,y)格子,读取第index个

axis:(x_start,x_end,y_start,y_end): 改变图形刻度

A = magic(5)

clf:清除屏幕

imagesc(A),colorbar

addpath():search path 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

江湖无为

感谢你们的鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值