Author Topic: ODE45-jacobian  (Read 934 times)

Offline john

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
ODE45-jacobian
« on: January 25, 2010, 08:22:55 AM »
I am trying to find a way to output the default jacobian computed by the ODE 45 function. If you could let me know how to do this, I would really appreciate it!


Thanks

Offline 50dolars

  • Newbie
  • *
  • Posts: 7
  • Matlab Forum
    • View Profile
Re: ODE45-jacobian
« Reply #1 on: November 10, 2010, 04:59:33 AM »
  • The ode45 function ...
                                       
                     
                        The ode45 function is designed to solve a set of differential equations for any number of variables.
[T, Y]? (http://escwiki.esc.auckland.ac.nz/courses/enggen131s2c/student-wiki/TheOde45Function/createform?page=T%2C%20Y) = ode45(odefun, tspan, y0)
Inputs in function:
odefun - a user defined matlab function which defines the Right Hand Side of the ordinary differential equation. This function has an output of [f]? (http://escwiki.esc.auckland.ac.nz/courses/enggen131s2c/student-wiki/TheOde45Function/createform?page=f) and an input of time and the variables (t,y).
This function should evaluate all the variables and the functions, for examplefunction [f]? (http://escwiki.esc.auckland.ac.nz/courses/enggen131s2c/student-wiki/TheOde45Function/createform?page=f) = reactorfunc(t,y)
% set up constants
E = some number;
R = 8.314;
k = another number;
h = some other number;
% evaluate the right hand side of the equation
% in this example, there are two variables, so two differential equations. These are put into a matrix named 'f' where the first row is the first variable, the second row is the second variable.
f(1) = k*y(1).*exp(-E/R/y(2));
f(2) = h*k*y(1).*exp(-E/R/y(2));
% The 'f' matrix must be transposed when there are two variables, as the ode45 function takes the matrix in the transposed form.
f = f';
return;tspan - an array that states the time range. ie. tspan (1) = intial time;
tspan(2) = final time;y0 - an array that sets up the initial conditions of the variables.ie. y0(1) = initial value for variable one.
y0(2) = initial value for variable two.Output of function:
The ode45 function returns two arrays [T, Y]? (http://escwiki.esc.auckland.ac.nz/courses/enggen131s2c/student-wiki/TheOde45Function/createform?page=T%2C%20Y)
The T array is a range of times,
The Y array is the valuesof the variables, that correspond to the time array.
rpul013

Matlab and SimuLink Development Forum

Re: ODE45-jacobian
« Reply #1 on: November 10, 2010, 04:59:33 AM »