In this tutorial, we will learn about Octave Power Operator
Octave Power Operator
We have two operators in Octave to compute the power.
x ^ y
x ** y
The result of the computation depends on the values of the operands x and y.
If both x and y are scalars then
x ^ y returns the result x raised to the power of y.
If x is scalar and y is a square matrix the result would be eigenvalue expansion.
Let’s look at a simple example.
>> x = 2;
>> y = 3;
>> result = x ^ y;
result = 8
The result is 2*2*2 = 8
We can also use the ** operator.
>> x = 4;
>> y = 4;
>> result = x ** y;
result = 256
Element wise Power
To compute element-wise matrix power calculation, we can use the following operator.
>> x = 2 ;
>> y = [2, 3; 3 , 5];
>> result = x.^ y
GNU Octave Tutorials on this website can be found at:
For more information on Octave, visit the official website: