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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Consider the recursion relation:

x_n = (x_(n-1)*x_(n-2))^k

Given x_1, x_2, and k, x_n can be found by this definition. Write a function which takes as input arguments x_1, x_2, n and k. The output should be x_n.

For example, if x_1=exp(1), x_2=pi, n=5, and k=5/9 then:

R = get_recurse(exp(1),pi,5,4/9)

R = 2.31187497992966

69 correct solutions
35 incorrect solutions

Last solution submitted on May 17, 2015

1 Comment

Binbin Qi
on 9 May 2012

it cost much too time,so .....

1 Comment

David Young
on 29 Feb 2012

Fails for both n=1 and n=2?

2 players like this solution

2 Comments

@bmtran
on 9 Feb 2012

holy moly, you posted this one mere seconds after i posted mine.

David Young
on 29 Feb 2012

Fails for n=1?

3 players like this solution

2 Comments

Alfonso Nieto-Castanon
on 9 Feb 2012

that was a photo-finish :)

David Young
on 29 Feb 2012

OK for both n=1 and n=2.

4 Comments