Contents

Aaron Klapheck

% In class 20-Mar-08
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 08-Apr-2008 11:55:20 

Notes

% Ordinary Differential Equations (ODE's)
%   see pages 703 and 706 in text book
%
%   Solve IVPs via ODE45
%       First order differential equation (FODE)
%           dy/dt = 3t
%           y(0) = 0                       .... (initc)
%           for 0 <= t =< 10 sec           .... (Tspan)
%
%           Use:
%             [t, y] = ode45(@fun, [Tspan], [initc], p1, p2, ...)
%
%               fun: dydt = pt;            ..... (where p = 3)
%               function [dydt] = fun(t, y, P)
%
%
%       Second order differential equation
%           (d_2)y/(dt)_2 = 3dy/dt + 6t
%           y(0) = 0                       .... (initc)
%           y'(0) = 3                      .... (initc)
%           for 0 <= t =< 10 sec           .... (Tspan)
%
%           Use:
%
%               function [dydt] = fun(t, y, P1, P2)
%               dydt = ?
%                   Use change of variables to convert the 2nd order IVP to
%                   two 1st order IVP's.
%
%                   (d_2)y/(dt)_2 = 3dy/dt + 6t ...(1)
%                   let y_1 = y                 ...(2)
%                   dy/dt = dy_1/dt = y_2       ...(3)
%                   (d_2)y/(dt)_2 = dy_2/dt     ...(4)
%
%                   Sub (2), (3), and (4) into (1)
%
%               dydt = [y_2; 3*y_2 + 6*t];
%
%       5th order differential equation
%
%           Same as above but: (d_6)y/(dt)_6
%
%               dydt = [y_2; y_3; y_4; y_5; y_6; 3*y_2 + 6*t]
%               or
%               dydt = [y_2
%                       y_3
%                       y_4
%                       y_5
%                       y_6
%                       3*y_6 + 6*t]
%
%
%   Note:
%       ODE45 handles "smooth" or "non-jerky" curves
%       ODE23 handles "jerkey" curves (ie. stock market graphs)
%
% Do the following excersizes in book: 12.12
%   Use parameter passing with loops.
%   dy/dt = t^2/q - y
%
%    Use:
%       Function [dydt] = fun12a(t, t, q)
%           dydt = ((t.^2)./p) - y_1
%
%   For solving ODE's with a constant reppresented with a letter
%       for j = 1 to 5
%           if j == 1
%               p = 2
%           elseif j == 2
%               p = 3
%           .
%           .
%           .
%
%           end
%       next
%
%       [t, y] = ode45(@fun12a, [], [], [], p)
%
%   The output vector y contains y and all the missing derivatives
%       Ex: dy/dt = 2t              then y_t
%       Ex: (d_2)y/(dt)_2 = 2t      then y_t, y'(t) ... y'(t) = dy/dt(t)
%       Ex: (d_3)y/(dt)_3 = 2t      then y_t, y'(t), y''(t), y'''(t)
%