MATLAB: Please how to plot the recurrence equation such as the following example

homeworkrecurrence equation

such as the following two equation:
the first equation:
x(t+1) = 29x(t) mod 997 with initial two seed x0=117 and x0=118, and where the (t) value start from 0 t0 20 , and (xt) value between (0 and 1000) in the plot.
the second equation:
x(t+1)=2*(x(t)^2) -1 with initial two seed x0 = 0.25 and x0 = 0.26, and where the (t) value start from 0 t0 20 , and (xt) value between (-1 and 1) in the plot.
please answer me about creat matlab code to plot these separate equations
Thanks

Best Answer

As an outline:
x(0+1) = some constant
for t = 1 : number of iterations
x(t+1) = function1( x(t) )
end
plot(x)