Solving ODEs with Modeling & Matlab

  • Context: MATLAB 
  • Thread starter Thread starter Deuterio
  • Start date Start date
  • Tags Tags
    Matlab Modeling
Click For Summary

Discussion Overview

The discussion revolves around solving a system of ordinary differential equations (ODEs) related to modeling a chemical reactor using MATLAB. Participants explore different approaches to implement the solution using MATLAB's ode45 function and discuss the formulation of the equations.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • One participant presents a system of ODEs to model a chemical reactor and expresses difficulty in solving it using MATLAB's ode45.
  • Another participant suggests defining the state as a vector and provides a structure for the derivative function to be used with ode45, assuming familiarity with MATLAB solvers.
  • A third participant proposes reformulating the system into a more standard form and suggests that the system might be solvable by hand due to its "triangular" nature.
  • The original poster confirms that the suggestions provided have worked properly for their problem.

Areas of Agreement / Disagreement

Participants generally agree on the approaches to solving the system of ODEs, as evidenced by the original poster's confirmation that the provided options worked. However, there is no explicit consensus on the best method, as different strategies are discussed.

Contextual Notes

There are assumptions regarding the familiarity with MATLAB and the specific definitions of variables such as 'a', 'b', 'c', and 'T0', which are not fully detailed in the discussion. The mathematical steps for the proposed solutions are not fully resolved.

Who May Find This Useful

This discussion may be useful for individuals working on modeling chemical processes, particularly those seeking to solve systems of ODEs using MATLAB or looking for different approaches to mathematical modeling in engineering contexts.

Deuterio
Messages
2
Reaction score
0
I'm modeling a chemical reactor and I have to solve a system of ODE's like that:

dX/dV = a*X
dT/dV = b*(dX/dV) - c*(T-T0)

I've been a Matlab user for so long but I've never seen a solution of this kind of system. I've tried to solve using ode45 but it didn't work. I've searched in books and/or homepages about Matlab and I haven't found any tip.
If some one here could help me I'd be so grateful.

Thanks
 
Physics news on Phys.org
I may be a little rusty, but I think if you define your state as:
s = [X, dX/dV, T, dT/dV], then you can use ode45 (or any other MATLAB ode solver). (I'm assuming you've used the solvers before and you're just having trouble with this problem.) So your derivative function will look something like this:

...
function sdot = deriv(V,S)
% Current values of state parameters
X = S(0);
dXdV = S(1);
T = S(3);
dTdV = S(4);

% Updated values of derivatives of state parameters
dXdV=a*X;
d2XdV2 = a*dXdV;
dTdV = b*(dXdV) - c*(T-T0);
d2TdV2 = b*d2XdV2 - c*dTdV;

sdot = [dXdV, d2XdV2, dTdV, d2TdV2];
 
You could put the system in a more standard form. i.e. replace the occurrence of dx/dv in the second equation with a*X, not to mention that I think you can probably solve it out by hand because the system is "triangular"
 
Thanks

Both options have worked properly.
Thanks for your help!
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 9 ·
Replies
9
Views
7K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 11 ·
Replies
11
Views
17K
  • · Replies 3 ·
Replies
3
Views
7K