% MVW, 2010-09-10
% Cut and paste this text into Matlab
%
% Example Matlab instructions to solve x=cos(x) by fixed-point iteration
% and to plot the intermediate results.
%
x=1; y=x; for i=1:100 x=cos(x); y=[y x]; end
plot(y) % show convergence
plot(y(1:10)) % show initial errors
plot(log(abs(y-y(100)))) % show linear convergence rate