3

I've seen this thread talking about map: Map function in MATLAB?

As a result, I was wondering whether there are similar ways to do it taking into consideration of the indices. Such as if i want to do something like (x_i)^i.

thanks a lot!

Community
  • 1
  • 1
FurtiveFelon
  • 14,714
  • 27
  • 76
  • 97

1 Answers1

4

An example:

>> x = randi(10, [1 5])
x =
     9     7     4    10     1

>> x.^(1:numel(x))
ans =
    9      49    64   10000  1
Amro
  • 123,847
  • 25
  • 243
  • 454