matlab program components 之 数组和矩阵
2018-01-28 21:09
405 查看
program components 之 数组和矩阵
matlab 中的数组算数操作符
下面是对 matlab 中的数组运算操作符的一个总结。操作符 | 作用 | 描述|参考函数|
———|———-|———|—–|
| + | 加 | a + b| plus|
| + | 正| +a|uplus|
| - | 减 | b - a|minus|
| - | 负 | -a | uminus|
| .* | 点乘| a .* b|times|
| .^ | 点乘方 | a .^ b|power|
| ./ | 点右除 | a ./ b |rdivide|
| .\ | 点左除 | a .\ b| ldivide|
| .’ | 点转置 | a.’| transpose|
这里 “点” 的意思是点对点的,也即每个元素对元素的运算。
matlab 中矩阵运算操作符
操作符 | 作用 | 描述|参考函数|———|———-|———|—–|
| * | 矩阵乘 | a * b| mtimes|
| \ | 矩阵左除 | a\b |mldivide|
| / | 矩阵右除 | a/b |mrdivide|
| ^ | 矩阵乘方 | a^b | mpower |
| ’ | 转置 | a‘|ctranspose|
Compatible Array Sizes For Basic Operations
大部分 matlab 中的二元操作符或者函数都具有兼容性。也就是说,matlab 会对输入其中的参数自动进行隐式拓展以进行相关操作。这里要注意在旧的版本中提供了 bsxfun 函数用于显式拓展,但是新版本中的操作符已经有自动隐式拓展的功能了。
关系操作符
Symbol | Function Equivalent | Description|———|———-|———|
| < | lt | less than|
| <= | le | less than or equal to|
| ‘>’ |gt | grater than|
| >= | ge | grater than or equal to|
| == | eq | equal to|
| ~= | ne | not equal to|
注意,上表中的大于号加了单引号这是因为大于在有些版本的 markdown 中有特殊用途,用于单元格合并。加上引号就会避免显示上的问题。
对于复数而言,大于、小于、大于等于、小于等于都是只比较实数部分。而等于和不等于则比较实数和虚数部分。
inf nan NaT and undfined Element Comparisons
inf values are equal to other inf valuesnan values are not equal to any numeric value,including other nan values
NaT values are not equal to any other datetime value,including other NaT values.
Undefined categorical elements are not equal to any other categorical value,including other undefined elements.
matlab 中运算符的优先级
Parentheses ()Transpose (.’), power (.^), complex conjugate transpose (‘), matrix power (^)
Power with unary minus (.^-), unary plus (.^+), or logical negation (.^~) as well
as
4000
matrix power with unary minus (^-), unary plus (^+), or logical negation (^~).
Note: Although most operators work from left to right, the operators (^-), (.^-),
(^+), (.^+), (^~), and (.^~) work from second from the right to left. It is
recommended that you use parentheses to explicitly specify the intended precedence
of statements containing these operator combinations.
Unary plus (+), unary minus (-), logical negation (~)
Multiplication (.*), right division (./), left division (.), matrix multiplication
(*), matrix right division (/), matrix left division ()
Addition (+), subtraction (-)
Colon operator (:)
Less than (<), less than or equal to (<=), greater than (>), greater than or equal to
(>=), equal to (==), not equal to (~=)
Element-wise AND (&)
Element-wise OR (|)
Short-circuit AND (&&)
Short-circuit OR (||)
总结
其中关于 tolerance 的一节没有看懂,以后等有需要再研究。还有由于 markdown 解析器的问题,在 csdn 中显示有一定问题,请谅解。相关文章推荐
- Matlab数组、矩阵技巧
- Matlab软件的矩阵和数组操作
- Matlab矩阵和数组运算
- 【MATLAB 从零到进阶】day2 矩阵 数组
- Matlab与线性代数 -- 数组与矩阵的乘幂
- MATLAB 7.0 学习入门 -- (练习二 矩阵和数组基本操作)
- MATLAB中矩阵与数组的区别,点运算符的运用
- Matlab 矩阵就是数组 数组就是矩阵
- matlab 数组矩阵基本运算
- matlab---数组、矩阵
- Matlab矩阵和数组
- matlab 矩阵/数组使用总结
- matlab 矩阵,数组,算术运算及实例(2)
- matlab 中一些对数组或矩阵的处理
- 转载 matlab矩阵数组常用操作
- matlab(数组、矩阵)
- Matlab数组与矩阵
- MATLAB中依据数组下标去矩阵中元素
- MATLAB中通过矩阵索引值求元素下标以及转为C语言数组下标
- Matlab教程1_矩阵(数组) _ 元胞数组