% 4-14-2008 % Iteration example clear all; close all; x0 = 2; % A few different ways to solve the same problem: % Calculate the first iteration and then enter the loop beta = 0.5; x(1) = x0 + beta * sin(x0); for i=2:50 x(i) = x(i-1) + beta * sin(x(i-1)); end % We can calculate a bunch of different iterations at once for differnt % betas this way beta = [0.1 0.6 3.0]; x = [2 2 2]; for j=1:3 for i=2:51 x(i,j) = x(i-1,j) + beta(j) * sin(x(i-1,j)); end end