MATLAB 帮助中心
定点矩阵幂 (^)
Y = A^k
Y = mpower(A,k)
Y = A^k 为 fi 输入计算 A 的 k 次幂,并在 Y 中返回结果。
Y
A
k
fi
使用默认 fimath 设置执行矩阵幂运算。
fimath
定点输出数组 Y 具有与输入 A 相同的局部 fimath。如果 A 没有局部 fimath,则输出 Y 也没有局部 fimath。
示例
Y = mpower(A,k) 是执行 A^k 的另一种方式。
A^k
全部折叠
计算二维方阵对于指数值 0、1、2 和 3 的幂。
x = fi([0 1; 2 4], 1, 32); px0 = x^0
px0 = 1 0 0 1 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 1 FractionLength: 0
px1 = x^1
px1 = 0 1 2 4 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 32 FractionLength: 28
px2 = x^2
px2 = 2 4 8 18 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 65 FractionLength: 56
px3 = x^3
px3 = 8 18 36 80 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 98 FractionLength: 84
基数,指定为标量或矩阵。
示例: x = fi([0 1; 2 4],1,32);
x = fi([0 1; 2 4],1,32);
数据类型: fi 复数支持: 是
指数,指定为实数值整数。
数据类型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
全部展开
使用说明和限制:
当指数 k 是变量且输入是标量时,控制 fimath 的 ProductMode 属性必须为 SpecifyPrecision。
ProductMode
SpecifyPrecision
当指数 k 是变量且输入不是标量时,控制 fimath 的 SumMode 属性必须为 SpecifyPrecision。
SumMode
仅当起控制作用的 fimath 的 SumMode 属性设置为 SpecifyPrecision 或 Keep LSB 时,才支持可变大小的输入。
Keep LSB
对于可变大小信号,您可能会看到生成的代码与 MATLAB® 之间的结果不同。
在生成的代码中,可变大小信号的输出是使用起控制作用的 fimath 的 SumMode 属性计算的。
在 MATLAB 中,当第一个输入 A 是非标量时,使用控制 fimath 的 SumMode 属性计算可变大小信号的输出。然而,当 A 是标量时,MATLAB 使用控制 fimath 的 ProductMode 计算输出。
两个输入都必须为标量,并且指数输入 k 必须为常量整数。
在 R2010a 中推出
mpower | power | fi | fimath
mpower
power
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处