Path: news.mathworks.com!not-for-mail
From: "Peter " <peter.w.robinson@uon.edu.au>
Newsgroups: comp.soft-sys.matlab
Subject: Solving coupled differential equations
Date: Sun, 25 Mar 2012 23:57:12 +0000 (UTC)
Organization: University of  Newcastle
Lines: 34
Message-ID: <jkobco$8fr$1@newscl01ah.mathworks.com>
Reply-To: "Peter " <peter.w.robinson@uon.edu.au>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1332719832 8699 172.30.248.37 (25 Mar 2012 23:57:12 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 25 Mar 2012 23:57:12 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2433977
Xref: news.mathworks.com comp.soft-sys.matlab:762154

Hi All,

I am trying to solve a system of coupled differential equations. The number of equations is normally quite high, typically of the order of 600.

My differential equation is:
dx/dt+Ax=B

Where: - X is a 600x1 vector - A is a 600x600 matrix, and - B is a 600x1 vector.

Firstly, is matrices and an intrinsic ode solver the best way to go? (ie ode23 etc?)

The code that I have for this kind of solve is:
-------------------------------------------
t0=0; %Start time
tf=10; %Stop time
tspan=0:0.1:10;
 
 init_conditions=zeros(1,6*N-2);
 
 [T, Z]=ode23(@dynamics,tspan,init_conditions);
--------------------------------------------
and the function:
-------------------------------------------
function dx=dynamics(t,x)

global A B

dx=B-A*x;
---------------------------------------------
B and A are also defined as global in the main program.

Any help is appreciated.

Cheers, Peter