Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Vectorize element wise power operation

Subject: Vectorize element wise power operation

From: Engin

Date: 16 Oct, 2010 02:28:04

Message: 1 of 3

Is it possible to generate the following vector without doing loops or so?

[a^0 a^1 a^2 .... a^k-1]

Best,
Engin

Subject: Vectorize element wise power operation

From: Ross W

Date: 16 Oct, 2010 02:40:05

Message: 2 of 3

"Engin " <bene_a4@yahoo.com> wrote in message <i9b2jk$6lr$1@fred.mathworks.com>...
> Is it possible to generate the following vector without doing loops or so?
>
> [a^0 a^1 a^2 .... a^k-1]
>
> Best,
> Engin

a.^[0:k-1]

Ross

Subject: Vectorize element wise power operation

From: Roger Stafford

Date: 16 Oct, 2010 02:51:03

Message: 3 of 3

"Engin " <bene_a4@yahoo.com> wrote in message <i9b2jk$6lr$1@fred.mathworks.com>...
> Is it possible to generate the following vector without doing loops or so?
>
> [a^0 a^1 a^2 .... a^k-1]
>
> Best,
> Engin
- - - - - - - -
 b = cumprod([1,repmat(a,1,k-1)]);

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us