MATLAB:Ordinary Differential Equations

From PrattWiki
Revision as of 16:06, 10 November 2009 by DukeEgr93 (talk | contribs)
Jump to navigation Jump to search

Introduction

This page is aimed at introducing techniques for solving initial-value problems involving ordinary differential equations using MATLAB. Specifically, it will look at systems of the form:

\( \begin{align} \frac{dy}{dt}&=f(t, y, k) \end{align} \)

where \(y\) represents an array of dependent variables, \(t\) represents the independent variable, and \(k\) represents an array of constants. Note that although the equation above is a first-order differential equation, many higher-order equations can be re-written to satisfy the form above.

In addition, the examples on this page will assume that the initial values of the variables in $y$ are known - this is what makes these kinds of problems initial value problems (as opposed to boundary value problems).

Solving initial value problems in MATLAB may be done with two coding components. The first will be a function that accepts the independent variable, the dependent variables, and any necessary constant parameters and returns the values for the first derivatives of each of the dependent variables. In other words, you will need to write a .m function that takes \(t\), \(y\), and possibly \(k\) and returns \(f(t, y, k)\). Note that the output needs to be returned as a column vector.

The second file will be a script or function that uses the first function in concert with MATLAB's ODE solvers to calculate solutions over a specified time range assuming given initial conditions.

Questions

Post your questions by editing the discussion page of this article. Edit the page, then scroll to the bottom and add a question by putting in the characters *{{Q}}, followed by your question and finally your signature (with four tildes, i.e. ~~~~). Using the {{Q}} will automatically put the page in the category of pages with questions - other editors hoping to help out can then go to that category page to see where the questions are. See the page for Template:Q for details and examples.

External Links

References