To calculate the power of an object in Matlab, you can use the power operator ^.
Syntax:
main.m25 chars2 lines
Example 1:
main.m104 chars6 lines
Output:
main.m2 chars2 lines
Example 2:
main.m92 chars7 lines
Output:
main.m3 chars2 lines
In Matlab, you can also use the built-in power
function to perform element-wise power calculation of two arrays. The power
function raises each element of the array A
to the power of the corresponding element in the array B
.
Syntax:
main.m15 chars2 lines
Example:
main.m176 chars10 lines
Output:
main.m19 chars2 lines
gistlibby LogSnag