
Matlab Recursion Problem
Write a MATLAB function xrecursion(f,x0,n)
Where f is a function handle, n is a positive integer and x is the array x0 x1 . . . xn defined
by xk fxk1 , k 1, 2, . . , n where x0 is given by the input x0. Plot the sequence xk
k0 n as a function of k.
Then improve this function so that it can calculate a vector sequence x k f x k1 given x 0.
A plot is not needed for this case.
An example of a vector function f, whose input and output are 2x1 arrays, might be:
f@(x) [x(2), x(1)^2x(2)^2 ; x(1)*x(2), x(1)]
(commas are optional when defining arrays andare included here for clarity)