Element by Element Operations – Exponentiation (.^)

Element Exponentiation

For element by element exponentiation we follow the normal rules for element by element operations. Suppose we have two sets of cubes, a red set and a blue set and we know the lengths. We can use element by element exponentiation to calculate the area of a face and the volume of the cube:

To write this in Octave/MATLAB we would use:

Lengths = [1,2,3;2,4,8]
Areas = [1,2,3;2,4,8].^2
Areas = [1,2,3;2,4,8].*[1,2,3;2,4,8]
Volumes = [1,2,3;2,4,8].^3
Volumes = [1,2,3;2,4,8].*[1,2,3;2,4,8].*[1,2,3;2,4,8]


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.