初等数学
算术运算
基本算术
加法
+ |
添加数字,追加字符串 |
---|---|
sum |
数组元素总和 |
cumsum |
累积和 |
movsum |
移动总和 |
matlab
A = 1:5;
B = cumsum(A)
B = 1×5
1 3 6 10 15
减法
- |
减法 |
---|---|
diff |
差分和近似导数 |
乘法
.* |
乘法 |
---|---|
* |
矩阵乘法 |
prod |
数组元素的乘积 |
cumprod |
累积乘积 |
pagemtimes |
按页矩阵乘法 (自 R2020b 起) |
tensorprod |
Tensor products between two tensors (自 R2022a 起) |
除法
./ |
数组右除 |
---|---|
.\ |
数组左除 |
/ |
求解关于 x 的线性方程组 xA = B |
\ |
求解关于 x 的线性方程组 Ax = B |
pagemldivide |
Page-wise left matrix divide (自 R2022a 起) |
pagemrdivide |
Page-wise right matrix divide (自 R2022a 起) |
幂
.^ |
按元素求幂 |
---|---|
^ |
矩阵幂 |
转置
.' |
转置向量或矩阵 |
---|---|
' |
复共轭转置 |
pagetranspose |
按页转置 (自 R2020b 起) |
pagectranspose |
按页复共轭转置 (自 R2020b 起) |
数组符号
uminus |
一元减法 |
---|---|
uplus |
一元加法 |
模除法和舍入
A = 1:5;
B = cumsum(A)
B = 1×5
1 3 6 10 15
自定义二元函数
bsxfun |
对两个数组应用按元素运算(启用隐式扩展) |
---|---|
三角学
正弦
sin |
参数的正弦,以弧度为单位 |
---|---|
sind |
参数的正弦,以度为单位 |
sinpi |
准确地计算 sin(X*pi) |
asin |
反正弦(以弧度为单位) |
asind |
反正弦(以度为单位) |
sinh |
双曲正弦 |
asinh |
反双曲正弦 |
余弦
cos |
以弧度为单位的参数的余弦 |
---|---|
cosd |
以度为单位的参数的余弦 |
cospi |
准确计算 cos(X*pi) |
acos |
反余弦(以弧度为单位) |
acosd |
反余弦(以度为单位) |
cosh |
双曲余弦 |
acosh |
反双曲余弦 |
正切
tan |
以弧度表示的参数的正切 |
---|---|
tand |
以度表示的参数的正切 |
atan |
反正切(以弧度为单位) |
atand |
反正切(以度为单位) |
atan2 |
四象限反正切 |
atan2d |
四象限反正切(以度为单位) |
tanh |
双曲正切 |
atanh |
反双曲正切 |
余割
csc |
输入角的余割(以弧度为单位) |
---|---|
cscd |
以度为单位的参数的余割 |
acsc |
反余割(以弧度为单位) |
acscd |
反余割(以度为单位) |
csch |
双曲余割 |
acsch |
反双曲余割 |
正割
sec |
角的正割(以弧度为单位) |
---|---|
secd |
参数的正割,以度为单位 |
asec |
反正割(以弧度为单位) |
asecd |
反正割(以度为单位) |
sech |
双曲正割 |
asech |
反双曲正割 |
余切
cot |
角的余切(以弧度为单位) |
---|---|
cotd |
以度为单位的参数的余切 |
acot |
反余切(以弧度为单位) |
acotd |
反余切(以度为单位) |
coth |
双曲余切 |
acoth |
反双曲余切 |
斜边
hypot |
平方和的平方根(斜边) |
---|---|
转换
度/弧度转换
deg2rad |
将角从以度为单位转换为以弧度为单位 |
---|---|
rad2deg |
将角的单位从弧度转换为度 |
坐标转换
cart2pol |
将笛卡尔坐标转换为极坐标或柱坐标 |
---|---|
cart2sph |
将笛卡尔坐标转换为球面坐标 |
pol2cart |
将极坐标或柱坐标转换为笛卡尔坐标 |
sph2cart |
将球面坐标转换为笛卡尔坐标 |
指数和对数
exp |
指数 |
---|---|
expm1 |
针对较小的 X 精确计算 exp(X)-1 |
log |
自然对数 |
log10 |
常用对数(以 10 为底) |
log1p |
针对较小的 X 精确计算 1+X 的自然对数 |
log2 |
以 2 为底的对数和浮点数分解 |
nextpow2 |
2 的更高次幂的指数 |
nthroot |
实数的第 n 次实根 |
pow2 |
浮点数的以 2 为底的幂运算和缩放 |
reallog |
非负实数数组的自然对数 |
realpow |
仅实数输出的数组幂 |
realsqrt |
非负实数数组的平方根 |
sqrt |
平方根 |
计算 1 的指数,它是欧拉数 e。
matlab
exp(1)
ans = 2.7183
复数
函数
abs |
绝对值和复数的模 |
---|---|
angle |
相位角 |
complex |
创建复数数组 |
conj |
复共轭 |
cplxpair |
将复数排序为复共轭对组 |
i |
虚数单位 |
imag |
复数的虚部 |
isreal |
确定数组是否使用复数存储 |
j |
虚数单位 |
real |
复数的实部 |
sign |
Sign 函数(符号函数) |
unwrap |
平移相位角 |
离散数学
质因数、阶乘、排列、有理分式、最小公倍数、最大公约数
离散数学函数对整数(...、-2、-1、0、1、2、...)执行运算,或以整数返回离散输出。您可以使用这些函数来分解大数、计算阶乘、计算排列组合或求解最大公分母。
函数
factor |
质因数 |
---|---|
factorial |
输入的阶乘 |
gcd |
最大公约数 |
isprime |
确定哪些数组元素为质数 |
lcm |
最小公倍数 |
nchoosek |
二项式系数或所有组合 |
perms |
所有可能的排列 |
matchpairs |
求解线性分配问题 (自 R2019a 起) |
primes |
小于等于输入值的质数 |
rat |
有理分式近似值 |
rats |
有理输出 |
多项式
曲线拟合、根、部分分式展开
多项式是包含非负整数指数的单个变量的方程。MATLAB 使用包含按降幂排序的多项式系数的数值向量来表示多项式。例如,[1 -4 4]
对应于 x2 - 4x + 4。有关详细信息,请参阅创建并计算多项式。
函数
poly |
具有指定根的多项式或特征多项式 |
---|---|
polyeig |
多项式特征值问题 |
polyfit |
多项式曲线拟合 |
residue |
部分分式展开(部分分式分解) |
roots |
多项式根 |
polyval |
多项式计算 |
polyvalm |
矩阵多项式计算 |
conv |
卷积和多项式乘法 |
deconv |
去卷积和多项式除法 |
polyint |
多项式积分 |
polyder |
多项式微分 |
线性代数
线性方程、特征值、奇异值、分解、矩阵运算、矩阵结构
MATLAB 中的线性代数函数提供快速且数值稳健的矩阵计算。功能包括各种矩阵分解、线性方程求解、计算特征值或奇异值等。有关介绍,请参阅MATLAB 环境中的矩阵。
函数
全部折叠\](javascript:void(0)😉 #### 线性方程 | [`mldivide`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/mldivide.html) | 求解关于 x 的线性方程组 Ax = B | |-------------------------------------------------------------------------------------------------|----------------------------------------------| | [`mrdivide`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/mrdivide.html) | 求解关于 x 的线性方程组 xA = B | | [`pagemldivide`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagemldivide.html) | Page-wise left matrix divide *(自 R2022a 起)* | | [`pagemrdivide`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagemrdivide.html) | Page-wise right matrix divide *(自 R2022a 起)* | | [`decomposition`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/decomposition.html) | 求解线性系统的矩阵分解 | | [`lsqminnorm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/lsqminnorm.html) | 线性方程的最小范数最小二乘解 | | [`linsolve`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/linsolve.html) | 对线性系统求解 | | [`inv`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/inv.html) | 矩阵求逆 | | [`pageinv`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pageinv.html) | Page-wise matrix inverse *(自 R2022a 起)* | | [`pinv`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pinv.html) | Moore-Penrose 伪逆 | | [`lscov`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/lscov.html) | 存在已知协方差情况下的最小二乘解 | | [`lsqnonneg`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/lsqnonneg.html) | 求解非负线性最小二乘问题 | | [`sylvester`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/sylvester.html) | 求解关于 X 的西尔维斯特方程 AX + XB = C | #### 特征值和奇异值 | [`eig`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/eig.html) | 特征值和特征向量 | |-----------------------------------------------------------------------------------------|-------------------------------------------------------| | [`pageeig`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pageeig.html) | Page-wise eigenvalues and eigenvectors *(自 R2023a 起)* | | [`eigs`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/eigs.html) | 特征值和特征向量的子集 | | [`balance`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/balance.html) | 对角线缩放以提高特征值准确性 | | [`svd`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/double.svd.html) | 奇异值分解 | | [`pagesvd`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagesvd.html) | Page-wise singular value decomposition *(自 R2021b 起)* | | [`svds`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/svds.html) | 奇异值和向量的子集 | | [`svdsketch`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/svdsketch.html) | 计算低秩矩阵草图的 SVD *(自 R2020b 起)* | | [`svdappend`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/svdappend.html) | Revise SVD after appending data *(自 R2023b 起)* | | [`gsvd`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/gsvd.html) | 广义奇异值分解 | | [`ordeig`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/ordeig.html) | 拟三角矩阵的特征值 | | [`ordqz`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/ordqz.html) | 在 QZ 分解中将特征值重新排序 | | [`ordschur`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/ordschur.html) | 在 Schur 分解中将特征值重新排序 | | [`polyeig`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/polyeig.html) | 多项式特征值问题 | | [`qz`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/qz.html) | 广义特征值的 QZ 分解 | | [`hess`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/hess.html) | 矩阵的 Hessenberg 形式 | | [`schur`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/schur.html) | Schur 分解 | | [`rsf2csf`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/rsf2csf.html) | 将实数 Schur 形式转换为复数 Schur 形式 | | [`cdf2rdf`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/cdf2rdf.html) | 将复数对角型转换为实数块对角型 | #### 矩阵分解 | [`lu`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/lu.html) | LU 矩阵分解 | |-------------------------------------------------------------------------------------------|--------------------| | [`ldl`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/ldl.html) | 埃尔米特不定矩阵的分块 LDL 分解 | | [`chol`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/chol.html) | Cholesky 分解 | | [`cholupdate`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/cholupdate.html) | Cholesky 分解的秩 1 更新 | | [`qr`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/qr.html) | QR 分解 | | [`qrdelete`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/qrdelete.html) | 从 QR 分解中删除列或行 | | [`qrinsert`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/qrinsert.html) | 将列或行插入 QR 分解 | | [`qrupdate`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/qrupdate.html) | QR 分解的秩 1 更新 | | [`planerot`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/planerot.html) | Givens 平面旋转 | #### 矩阵运算 | [`transpose`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/transpose.html) | 转置向量或矩阵 | |---------------------------------------------------------------------------------------------------|--------------------------------------------------------| | [`ctranspose`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/ctranspose.html) | 复共轭转置 | | [`pagetranspose`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagetranspose.html) | 按页转置 *(自 R2020b 起)* | | [`pagectranspose`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagectranspose.html) | 按页复共轭转置 *(自 R2020b 起)* | | [`mtimes`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/mtimes.html) | 矩阵乘法 | | [`pagemtimes`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagemtimes.html) | 按页矩阵乘法 *(自 R2020b 起)* | | [`mpower`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/mpower.html) | 矩阵幂 | | [`sqrtm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/sqrtm.html) | 矩阵平方根 | | [`expm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/expm.html) | 矩阵指数 | | [`expmv`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/expmv.html) | Matrix exponential multiplied by vector *(自 R2023b 起)* | | [`logm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/logm.html) | 矩阵对数 | | [`funm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/funm.html) | 计算常规矩阵函数 | | [`kron`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/kron.html) | Kronecker 张量积 | | [`cross`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/cross.html) | 叉积 | | [`dot`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/dot.html) | 点积 | #### 矩阵结构 | [`bandwidth`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/bandwidth.html) | 矩阵的上下带宽 | |---------------------------------------------------------------------------------------------|------------------------------------| | [`tril`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/tril.html) | 矩阵的下三角形部分 | | [`triu`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/triu.html) | 矩阵的上三角部分 | | [`isbanded`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/isbanded.html) | 确定矩阵是否在特定带宽范围内 | | [`isdiag`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/isdiag.html) | 确定矩阵是否为对角矩阵 | | [`ishermitian`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/ishermitian.html) | 确定矩阵是 Hermitian 矩阵还是斜 Hermitian 矩阵 | | [`issymmetric`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/issymmetric.html) | 确定矩阵是对称矩阵还是斜对称矩阵 | | [`istril`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/istril.html) | 确定矩阵是否为下三角矩阵 | | [`istriu`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/istriu.html) | 确定矩阵是否为上三角矩阵 | #### 矩阵属性 | [`norm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/norm.html) | 向量范数和矩阵范数 | |----------------------------------------------------------------------------------------|------------------------------------------------| | [`pagenorm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/pagenorm.html) | Page-wise matrix or vector norm *(自 R2022b 起)* | | [`normest`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/normest.html) | 2-范数估值 | | [`vecnorm`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/vecnorm.html) | 向量范数 | | [`cond`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/cond.html) | 逆运算的条件数 | | [`condest`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/condest.html) | 1-范数条件数估计 | | [`rcond`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/rcond.html) | 条件数倒数 | | [`condeig`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/condeig.html) | 与特征值有关的条件数 | | [`det`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/det.html) | 矩阵行列式 | | [`null`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/null.html) | 矩阵的零空间 | | [`orth`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/orth.html) | 适用于矩阵范围的标准正交基 | | [`rank`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/rank.html) | 矩阵的秩 | | [`rref`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/rref.html) | 简化的行阶梯形矩阵(Gauss-Jordan 消去法) | | [`trace`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/double.trace.html) | 对角线元素之和 | | [`subspace`](https://www.mathworks.com/help/releases/R2023b/matlab/ref/subspace.html) | 两个子空间之间的角度 | **引用与Matlab官方文档**