%% Annotated Matlab transcript -- 2/27 %% CS 323 - Doug DeCarlo % Here are the fixed point example functions, evaluated % at their fixed points: 1 + 0.5*sin(1.4987) 3 + 2*sin(3.0944) % Here are plots - note how fixed points are where y=x intersects y=g(x) x = -1:0.01:4; plot(x,1+0.5*sin(x), x,3+2*sin(x), x,x) % We can take a wider view to see that these are the only fixed points... x = -20:0.01:20; plot(x,1+0.5*sin(x), x,3+2*sin(x), x,x) % Lets see if the first one converges... x = 0; for i=1:20 x = 1 + 0.5*sin(x); r(i) = x; end plot(1:length(r),r,'.-') % it does! % and how about the second one? x = 0; for i=1:20 x = 3+2*sin(x); r(i) = x; end plot(1:length(r),r,'.-') % no luck there.. it doesn't converge