% Matlab diary from cs111, Dec 3 2007. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. diary on help meshgrid [y1,y2] = meshgrid(-1:.01:1); whos y1 y2 clc altitude = y1 .^ 2 + (y2/1000) .^ 2; whos surf(y1,y2,altitude) myfunc = @(a,b) a + 2*b; whos myfunc(3,4) f = @(t,y) [-2*y(1) ; -y(2)/500] / norm([-2*y(1) ; -y(2)/500]) f(1, [1;1]) f(1, [0;1]) f(10000, [0;1]) ode23(f, [0 10], [0 ; 10]) legend('y(1)=East','y(2)=North') [T,Y] = ode23(f, [0 10], [0 ; 10]); size(T) Y plot(Y(:,1), Y(:,2)) ode23(f, [0 10], [0.01 ; 10]) [T,Y] = ode23(f, [0 10], [0.01 ; 10]); size(T) T plot(Y(:,1), Y(:,2)) axis equal plot(Y(:,1), Y(:,2), '.-'); axis equal [T,Y] = ode23(f, [0 10], [0.01 ; 10]); ode23(f, [0 10], [0.01 ; 10]); ode23s(f, [0 10], [0.01 ; 10]); [T,Y] = ode23s(f, [0 10], [0.01 ; 10]); size(T) plot(Y(:,1), Y(:,2), '.-'); axis equal edit ode23s diary off