MATLAB: Implementation of iterative function

matlab function

How can we implement the iterative function F(x)= [((1-2*q)*(x-q))/(p-q)]+q we have to iterate it for some values of i and generate the values of xi where xi=F(xi-1). initially let.

Best Answer

n=...;
p=...;
q=...;
x0=...;
f=@(x)(1-2*q)*(x-q)/(p-q)+q;
for ii=1:n
xnew=f(xold);
xold=xnew;
end
Best wishes
Torsten.