help ode45 ODE45 Solve differential equations, higher order method. ODE45 integrates a system of ordinary differential equations using 4th and 5th order Runge-Kutta formulas. [T,Y] = ODE45('yprime', T0, Tfinal, Y0) integrates the system of ordinary differential equations described by the M-file YPRIME.M, over the interval T0 to Tfinal, with initial conditions Y0. [T, Y] = ODE45(F, T0, Tfinal, Y0, TOL, 1) uses tolerance TOL and displays status while the integration proceeds. INPUT: F - String containing name of user-supplied problem description. Call: yprime = fun(t,y) where F = 'fun'. t - Time (scalar). y - Solution column-vector. yprime - Returned derivative column-vector; yprime(i) = dy(i)/dt. t0 - Initial value of t. tfinal- Final value of t. y0 - Initial value column-vector. tol - The desired accuracy. (Default: tol = 1.e-6). trace - If nonzero, each step is printed. (Default: trace = 0). OUTPUT: T - Returned integration time points (column-vector). Y - Returned solution, one solution column-vector per tout-value. The result can be displayed by: plot(tout, yout). See also ODE23, ODEDEMO. type yprime function y = yprime(t,x) t = t+0.01; A = [1 5; -5 1]; y = A*x; y(1) = y(1) * sin(31.415*sqrt(2)*t); y(2) = y(2) * sin(3.1415*t); [T,Y] = ode45('yprime',0,10,[1;1],1.e-6,1); size(T) ans = 586 1 size(Y) ans = 586 2 figure(2) hold Current plot held hold Current plot released plot(T,Y(:,1),'r') figure(1) hold Current plot released plot(T,Y(:,2),'b') plot(Y(:,1),Y(:,2),'r') type yprime function y = yprime(t,x) t = t+0.01; A = [1 5; -5 1]; y = A*x; % y(1) = y(1) * sin(31.415*sqrt(2)*t); % y(2) = y(2) * sin(3.1415*t); [T,Y] = ode45('yprime',0,10,[1;1],1.e-6,1); size(T) ans = 268 1 size(Y) ans = 268 2 figure(2) plot(T,Y(:,1),'r') figure(1) plot(T,Y(:,2),'b') plot(Y(:,1),Y(:,2),'r') type yp3 function y = yp3(t,x) k1 = 1; k2 = 10; R = [-k1 0 0;k1 -k2 0; 0 k2 0]; y = R*x; [T,Y] = ode45('yp3',0,10,[1;1;1],1.e-6,1); size(T) ans = 50 1 size(Y) ans = 50 3 figure(1) plot(T,Y(:,1),'r') hold Current plot held plot(T,Y(:,2),'b') plot(T,Y(:,3),'g') type yp3 function y = yp3(t,x) k1 = 1; k2 = 100; R = [-k1 0 0;k1 -k2 0; 0 k2 0]; y = R*x; [T,Y] = ode45('yp3',0,10,[1;1;1],1.e-6,1); size(T) ans = 295 1 size(Y) ans = 295 3 figure(1) hold Current plot released plot(T,Y(:,1),'r') hold Current plot held plot(T,Y(:,2),'b') plot(T,Y(:,3),'g') type yp3 function y = yp3(t,x) k1 = 1; k2 = 1000; R = [-k1 0 0;k1 -k2 0; 0 k2 0]; y = R*x; [T,Y] = ode45('yp3',0,10,[1;1;1],1.e-6,1); size(T) ans = 2743 1 size(Y) ans = 2743 3 hold Current plot released plot(T,Y(:,1),'r') plot(T,Y(:,2),'b') plot(T,Y(:,3),'g') lookfor ode ODE23 Solve differential equations, low order method. ODE23P Solve differential equations, low order method, displaying plot. ODE45 Solve differential equations, higher order method. contents.m: % Color control and lighting model functions. SHADING Color shading mode. DBQUIT Quit debug mode. DBSTEP Execute one or more MATLAB lines of code when in MATLAB debug mode. HIDDEN Mesh hidden line removal mode. AUREAD Read mu-law encoded audio file. AUWRITE Write mu-law encoded audio file. BUCKY Connectivity graph of the Buckminster Fuller geodesic dome. BUCKYDEM Connectivity graph of the Buckminster Fuller geodesic dome. CCODEGEN Provides information about the C-Code Generator CODEC Codec. HUMPS A function used by QUADDEMO, ZERODEMO and FPLOTDEMO. LALALA Modern version of LALA. LOTKA Lotka-Volterra predator-prey model. MODES Plot 12 modes of the L-shaped membrane. ODEDEMO Demonstrate numerical integration of differential equations. ZERODEMO This demo shows how to find the zero of a function. help ode23 ODE23 Solve differential equations, low order method. ODE23 integrates a system of ordinary differential equations using 2nd and 3rd order Runge-Kutta formulas. [T,Y] = ODE23('yprime', T0, Tfinal, Y0) integrates the system of ordinary differential equations described by the M-file YPRIME.M, over the interval T0 to Tfinal, with initial conditions Y0. [T, Y] = ODE23(F, T0, Tfinal, Y0, TOL, 1) uses tolerance TOL and displays status while the integration proceeds. INPUT: F - String containing name of user-supplied problem description. Call: yprime = fun(t,y) where F = 'fun'. t - Time (scalar). y - Solution column-vector. yprime - Returned derivative column-vector; yprime(i) = dy(i)/dt. t0 - Initial value of t. tfinal- Final value of t. y0 - Initial value column-vector. tol - The desired accuracy. (Default: tol = 1.e-3). trace - If nonzero, each step is printed. (Default: trace = 0). OUTPUT: T - Returned integration time points (column-vector). Y - Returned solution, one solution column-vector per tout-value. The result can be displayed by: plot(tout, yout). See also ODE45, ODEDEMO. figure(2) hold Current plot held hold Current plot released [T,Y] = ode23('yp3',0,10,[1;1;1],1.e-6,1); size(Y) ans = 4071 3 size(T) ans = 4071 1 figure(2) plot(T,Y(:,1),'r') hold Current plot held plot(T,Y(:,2),'b') plot(T,Y(:,3),'g') type yp3 function y = yp3(t,x) k1 = 1; k2 = 100; R = [-k1 0 0;k1 -k2 0; 0 k2 0]; y = R*x; [T,Y] = ode23('yp3',0,10,[1;1;1],1.e-2,1); size(T) ans = 399 1 size(Y) ans = 399 3 figure(2) plot(T,Y(:,1),'r*') plot(T,Y(:,2),'bo') plot(T,Y(:,3),'go') type predprey function y = predprey(t,x) b = 1; d = 10; c = 1; y = zeros(2,1); y(1) = b*x(1) - c*x(1)*x(2); y(2) = -d*x(2) + c*x(1)*x(2); [T,Y] = ode45('predprey',0,10,[0.5;1],1.e-6,1); size(T) ans = 148 1 size(Y) ans = 148 2 figure(2) hold Current plot released plot(T,Y(:,1),'ro') plot(T,Y(:,2),'bo') hold Current plot held plot(T,Y(:,1),'ro') figure(1) hold Current plot held plot(Y(:,1),Y(:,2),'r') hold Current plot released plot(Y(:,1),Y(:,2),'r') plot(Y(:,1),Y(:,2),'ro') min(Y(:,1)) ans = 4.774901492879678e-001 min(Y(:,2)) ans = 2.814103124492777e-010 diary off