% Matlab diary from cs111, Oct 1 2007. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. diary on help help 'matlab\elfun' sin(3.14) sin(3.1415926535897932) help sin doc pi sin(pi) a = 3; a b = 2 + 5 sqrt(b) ans ^ 2 A = [ 1 2 ; 3 4] b = [ 1 2 ] b = [ 1 ; 2 ] A b A * b figure b * A b * b b b' b * b' b' * b help ncm clear fern fern fern(10000) help fern help finitefern finitefern(10000) which fern edit fern A1 = [ .85 .04; -.04 .85]; b1 = [0; 1.6]; A1 b1 x = [.5 ; .5] axis on hold on plot(x(1),x(2),'ro') x x(1) A1 b1 x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') A1 b1 clf reset finitefern(100000) x=[.5;.5] hold on plot(x(1),x(2),'ro') x=[.5;.5] plot(x(1),x(2),'ro') x=[.5;.5] plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') A2 = [ .20 -.26; .23 .22]; b2 = [0; 1.6]; A3 = [-.15 .28; .26 .24]; b3 = [0; .44]; A4 = [ 0 0 ; 0 .16]; A1 A2 b1 b2 x = A2 * x + b2 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A1 * x + b1 plot(x(1),x(2),'ro') x = A3 * x + b3 plot(x(1),x(2),'ro') help rand rand rand rand rand rand rand rand rand axis on clc x = [.5 ; .5] for i = 1:1000, x = A1 * x + b1, end; plot(x(1),x(2),'ko') diary off