diary20050228

# diary20050228 - ydot vector of dy dt ydot =[y(2-y(1 clc...

This preview shows page 1. Sign up to view the full content.

% Matlab diary from cs110a, Feb 28 2005. % % This is what I typed in class. % % Type it into Matlab yourself to % reproduce the output I showed. help ode45 clf [T,Y] = ode45(@lve, [0 20], [300; 150]); size(T) size(Y) plot(T,Y) T(1:10) Y(1:10,:) plot(Y(:,1), Y(:,2)); xlabel('rabbits');ylabel('foxes');title('Phase Plot') edit f type f function ydot = f(t,y) % F : function ydot = f(t,y) for ODE solution % % t: scalar time % y: vector, y = y(t), unknown function
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % % ydot: vector of dy / dt ydot = [y(2) ; -y(1)]; clc ode45(@f, [0 10], [1 ; 0]); legend('x(t)', 'xdot(t)'); edit f type f function ydot = f(t,y) % F : function ydot = f(t,y) for ODE solution % falling object % % t: scalar time % y: vector, y = y(t), unknown function % % ydot: vector of dy / dt ydot = [y(2) ; -1 + (y(2))^2]; ode45(@f, [0 2], [1 ; 0]); legend('height of object', 'speed of object')...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online