% In class 18-Mar-08 clear, clc, home fprintf('The date and time: %s \n', datestr(now))
The date and time: 18-Mar-2008 14:58:03
% Solving a matrix graphically % % Ex: % -x + 2y + 3z = 5 % 3x - y - 4z = 0 % 5x + 2y + 9z = -1 % % solve system for a particular variable: i.e. x. % next set y and z equal to a range and mesh them. % % see in-class notes on 28-Feb-08 % % Solving ODE's % % Ex: 12.3 in book (see solving FODE in MATLAB below) % n = 1 - 1st order DE (FODE) % dy/dt = t - 2y ...(1), y(0) = 1 ....(2) % (1) is an IVP % Q: how does y behave over the interval 0 <= t <= 5 sec % A: Employ the Runge-Kutta 4th-5th order method in MATLAB % Command: ode45 % a) Create user-difined function in which the FODE is stored. % b) call the function using @ or passing the function as a string. % % ode45 % [T,Y] = ODE45(@ODEFUN,TSPAN,Y0,OPTIONS,P1,P2...) % y(0) = initial condition = ex: 5 % TSPAN = range of input independant variable = ex: [2 10] % ODEFUN = ODEFUN(t, y, P) % T = t-values, Y = y-values % % ODEFUN ex: [dydt] = rhs1(t, y, P, Q, C) % t = variable t of dy/dt % y = variable y of dy/dt % [dydt] = P*t + Q*y + C % % Showed code for solving example. Code availible in pickup box.