%This is a sample script file. Type the commands here % as if you were typing them "live" in Matlab. In % this example, I'm doing two function iterations, then % plotting the result with a title and a legend. x=0.7; %My initial value of x for k=1:100 %I'm going to do this 100 times y(k)=x*(1-x); %Do the function, save in an array z(k)=3.1*x*(1-x); x=y(k); %Re-set x for the next time around end %Since we might print this, use black for plotting plot(1:100, y, 'k-', 1:100, z,'k-.o'); title('Sample Function Iteration') legend('x(1-x)','3.1x(1-x)')