MATLAB: Plotting the graph changing by the range

range

the given equation is
n=~20
x(n+1)=1.4x(n) for 0<x<0.5
x(n+1)=1.4(1-x(n)) for 0.5<x<1
I tried to use 'if' and 'elseif', but I can't make it repeat.

Best Answer

x(1) = something
for n = 2 : number of iterations
if x(n) has some property
x(n+1) = some formula
elseif it has some other property
x(n+1) = some other formula
else
give an error because the situation is not defined
end
end
Related Question