Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solving coupled differential equations

Subject: Solving coupled differential equations

From: Peter

Date: 25 Mar, 2012 23:57:12

Message: 1 of 4

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

Subject: Solving coupled differential equations

From: Roger Stafford

Date: 26 Mar, 2012 05:10:11

Message: 2 of 4

"Peter " <peter.w.robinson@uon.edu.au> wrote in message <jkobco$8fr$1@newscl01ah.mathworks.com>...
> 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.
 - - - - - - - - -
  The solution to a linear system of differential equations like this should be expressible as linear combinations of exponentials with real or complex coefficients times time in terms of the eigenvalues and eigenvectors of -A with no need to use numerical ode solvers. Have you investigated that possibility?

Roger Stafford

Subject: Solving coupled differential equations

From: Peter

Date: 27 Mar, 2012 01:00:12

Message: 3 of 4

> The solution to a linear system of differential equations like this should be expressible as linear combinations of exponentials with real or complex coefficients times time in terms of the eigenvalues and eigenvectors of -A with no need to use numerical ode solvers. Have you investigated that possibility?
>
> Roger Stafford

Hi Roger,

I have considered finding coefficients and eigen-values, then calculating the response from here, however the form of the equation I gave you is likely to change depending on other parameters, so I deemed an intrinsic function to be most appropriate.

I have never used an ode solver before using matrices. Is it possible?

Thanks for the response,
Peter

Subject: Solving coupled differential equations

From: Bruno Luong

Date: 27 Mar, 2012 05:58:16

Message: 4 of 4

"Peter " <peter.w.robinson@uon.edu.au> wrote in message <jkr3es$h9c$1@newscl01ah.mathworks.com>...
>
> I have never used an ode solver before using matrices. Is it possible?

Yes of course.

Bruno

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us