Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 按元素计算向量的幂_Arrays_Matlab_Octave_Exponentiation_Elementwise Operations - Fatal编程技术网

Arrays 按元素计算向量的幂

Arrays 按元素计算向量的幂,arrays,matlab,octave,exponentiation,elementwise-operations,Arrays,Matlab,Octave,Exponentiation,Elementwise Operations,我有一个八度的向量[x,y,…],我想用元素的pth幂来得到新的向量[x^p,y^p,…]。有人知道怎么做吗 v = [1, 2, 3, 4, 5]; p = 2; w = v.^p; 输出(): 如果要对向量/矩阵应用操作元素,请在运算符前面加一个点: b=[1,2,3,4,5,6]; b2=b.^2; 哇,ideone看起来是个有用的工具。谢谢 b=[1,2,3,4,5,6]; b2=b.^2;

我有一个八度的向量
[x,y,…]
,我想用元素的pth幂来得到新的向量
[x^p,y^p,…]
。有人知道怎么做吗

v = [1, 2, 3, 4, 5];
p = 2;
w = v.^p;
输出():


如果要对向量/矩阵应用操作元素,请在运算符前面加一个点:

b=[1,2,3,4,5,6];
b2=b.^2;

哇,ideone看起来是个有用的工具。谢谢
b=[1,2,3,4,5,6];
b2=b.^2;