当前位置:网站首页>Octave basic syntax
Octave basic syntax
2020-11-08 21:03:00 【Come on, get up】
Octave Basic functions
Generating matrix functions
- eye(n): Generate n That's ok n The unit matrix of the column
- rand(n,m): Random generation n That's ok m The column size range is 0~1 Random number between
- randn(n,m): Generate according to Gaussian distribution n That's ok m Random number of columns
- ones(n,m): Generate n That's ok m The column elements are 1 Matrix
- zeros(n,m): Generate n That's ok m The column elements are 0 Matrix
Matrix operation function
- B = A(n:m): The matrix A Of the n Go to the first place m The value of the row is assigned to the matrix B
- A(n,m): take n That's ok m Column elements
- A([1 3],: ): The matrix A All the elements in the first and third lines are shown
- A(2,: ): The matrix A All the elements in the second line show up
- A = [A,B]: Base B Extended to matrix A To the right of , And assign the new matrix to A
- A = [A;B]: Base B Extended to matrix A Below , And assign the new matrix to A
- A(: ): take A All the elements in the column form a new column vector according to the direction of the column
- reshape(A(i:j), n, m):A It's a column vector ,i and j Denotes the th of the column vector i Items to j The term is taken out and reorganized into another matrix ,n and m They are the corresponding rows and columns after reorganization
Matrix operations
- a*b : matrix multiplication
- a.*b: Multiply each element
- a.^2: Square the elements
- 1./a: Yes a The reciprocal of the elements of
- log(a): Find logarithm
- exp(a): With e Bottom , With a Is a power
- abs(a): Find the absolute value
- v+ones(length(v),1): Yes v The element of plus 1
- A’:A The transpose
- prin(A): Inverse or pseudo inverse
- sum(a): Sum the data in the matrix
- prod(a): The product of
- floor(a): Rounding up
- ceil(a): Rounding down
- max(A,[],1): Take the maximum value of each column
- max(A,[],2): Take the maximum of each row
- max(max(A)): The maximum in the matrix
Make a simple picture
- plot(x,y): With x Abscissa ,y The vertical coordinates are plotted , The third parameter is optional , Represents the image type ('r’ The color is red )
- hold on: Put multiple pictures in the same image . usage : Draw... First plot(t,y1); And then in and out of hold on; And then input plot(t,y2), That is, two images can be displayed at the same time
- xlabel(xString):xString Express x The name of the axis
- ylabel(yString):yString Express y The name of the axis
- legend(string1, string2…): Name each curve in the drawing order
- title(tString):tString Indicates the name of the chart
- print -dpng ‘file.png’: Save the chart as png picture
- close: Turn off the currently open chart
- figure(n): Use plot Use this function before the function , Guarantee n Different , Multiple chart windows can be opened without being covered
- subplot(1,2,1): Divide the drawing into 1*2 The grid of , Use the first grid when drawing
- axis([x1,x2,y1,y2]): Set scale value ,[x1,x2] Is the scale range of the horizontal axis ,[y1,y2] Is the scale range of the vertical axis
- imagesc(A): For matrix A Draw a color matrix , Different values correspond to different color depths
Common operations
- PS1(">> “): Change the command line preamble to ”>> "
- size(A,[N]):A For a matrix , When the first parameter is omitted, the function returns an array [n,m], among n by A Row number ,m by A Columns of ; The second parameter is optional , Represents the dimension of a matrix , Back to page N Dimension of dimension . for example
A = 1
2
3
4
5
6
7
8
9
size(A) = 9 1
size(A,1) = 9
size(A,2) = 1
- disp(): Print variables or strings
- pwd: Show current path
- load: Load data file
- who: Query the variable name in the workspace
- whos: Query the details in the workspace
- clear: Clear a variable (clear x), if clear There is no variable after , All variables are cleared
- clc: Clear the screen
- save file A: take A The matrix is stored in a file file in
版权声明
本文为[Come on, get up]所创,转载请带上原文链接,感谢
边栏推荐
- Not a programmer, code can't be too ugly! The official writing standard of Python: pep8 everyone should know
- Using fastai to develop and deploy image classifier application
- 11 important operations of Python list
- 使用Fastai开发和部署图像分类器应用
- 综合架构的简述
- Tasks of the first week of information security curriculum design (analysis of 7 instructions)
- Dynamic ReLU:微软推出提点神器,可能是最好的ReLU改进 | ECCV 2020
- git操作与分支管理规范
- WordPress网站程序和数据库定时备份到七牛云图文教程
- net.sf.json . jsonobject's format processing of time stamp
猜你喜欢

给大家介绍下,这是我的流程图软件 —— draw.io

Opencv solves the problem of ippicv download failure_ 2019_ lnx_ intel64_ general_ 20180723.tgz offline Download

Development and deployment of image classifier application with fastai

. net core cross platform resource monitoring library and dotnet tool

解决IE、firefox浏览器下JS的new Date()的值为Invalid Date、NaN-NaN的问题

Swagger介绍和应用
![[200 interview experience], programmer interview, common interview questions analysis](/img/fb/625e17f83f6be064f7387e78ec082a.jpg)
[200 interview experience], programmer interview, common interview questions analysis

Looking for better dynamic getter and setter solutions

Countdownlatch explodes instantly! Based on AQS, why can cyclicbarrier be so popular?

WordPress网站程序和数据库定时备份到七牛云图文教程
随机推荐
Learn volatile, you change your mind, I see
如果把编程语言当武功绝学!C++是九阴真经,那程序员呢?
Brief VIM training strategy
快来看看!AQS 和 CountDownLatch 有怎么样的关系?
CountDownLatch 瞬间炸裂!同基于 AQS,凭什么 CyclicBarrier 可以这么秀?
C/C++知识分享: 函数指针与指针函数,看完这篇你还能不懂?
CMS垃圾收集器
CMS垃圾收集器
【杂谈】JS相关的线程模型整理
Dynamic ReLU:微软推出提点神器,可能是最好的ReLU改进 | ECCV 2020
Looking for better dynamic getter and setter solutions
Python 列表的11个重要操作
MongoDB数据库
SQL 速查
opencv 解决ippicv下载失败问题ippicv_2019_lnx_intel64_general_20180723.tgz离线下载
Mongodb add delete modify query operation
MongoDB增删改查操作
寻找性能更优秀的动态 Getter 和 Setter 方案
net.sf.json . jsonobject's format processing of time stamp
To introduce to you, this is my flow chart software—— draw.io