System of differential equations with constant (as variables) coefficients

Hi
I have 4 differential equations that I need to solve, but the coefficients for each term in each equation are different unknown constants. I read about solving it using a matrix and came up with:
syms A(t) B(t) C(t) D(t) k1 kn1 k2 kn2 k3 kn3 k4 kn4 k5 kn5 k6 kn6
Z = [A;B;C;D];
X = [-(k1+k3+k5), kn1, kn3, kn5; k1, -(kn1+k2+k6), kn6, kn2; k3, k6, -(kn3+k4+kn6), kn4; k5, k2, k4, -(kn2+kn4+kn5)];
Y = zeros(4,1);
eqn = diff(Z) == X*Z + Y;
[ASol(t), BSol(t), CSol(t), DSol(t),] = dsolve(eqn);
however that does not seem to work. Any help would be appreciated

 採用された回答

Torsten
Torsten 2016 年 10 月 28 日

0 投票

Your system of ODEs is too complicated to be solved symbolically.
Specify the constants and use a numerical solver (e.g. ODE15s).
Best wishes
Torsten.

3 件のコメント

Marc Rosales
Marc Rosales 2016 年 10 月 28 日
I see. :(
Unfortunately this came from a theoretical chemical reaction, thus I cannot provide any values for the 12 constants I have. :'( Any suggestions on what application can handle these types of systems symbolically? Thanks!
Torsten
Torsten 2016 年 10 月 28 日
I wonder what you want to do with a symbolic solution if you don't know reasonable values for the constants ?
Best wishes
Torsten.
Marc Rosales
Marc Rosales 2016 年 10 月 28 日
^Exactly my question too.
To be completely honest, this is a problem a chemistry professor gave me, and I too am at a complete loss why I need a symbolic solution hahaha. Anyway, the constants may be any non-negative value afaik.
If I get a system of ODEs of 4 equations, around how many constants(as variables) can I use to still be solvable by Matlab? or do I need to eliminate the number of equations too? :/

サインインしてコメントする。

その他の回答 (1 件)

Teja Muppirala
Teja Muppirala 2016 年 10 月 28 日
As has been mentioned, with the k's explicitly accounted for, it's very complicated.
But if you consider the matrix X simply as some constant matrix X, regardless of what's in it, then the analytical solution is
Z(t) = expm(X*t)*x0
where x0 is the initial condition.
For example
% Make some random stable X matrix
X = randn(3);
X = X*X';
X = -X;
x0 = [1;2;3]; % Some initial condition
ode45(@(t,Z)X*Z,[0 3],x0) % Using ODE45
Z = [];
tList = 0:0.01:3;
for t = tList;
Z(:,end+1) = expm(X*t)*x0; % Using matrix exponential solution
end
hold on;
plot(tList, Z','k','linewidth',1);
title('Same answer with ode45 and expm')

2 件のコメント

Torsten
Torsten 2016 年 10 月 28 日
And does expm work for the symbolic (4x4)-matrix from above ?
I doubt it - and if it works, the solution will contain roots of a fourth-order symbolic polynomial, I guess.
Best wishes
Torsten.
Marc Rosales
Marc Rosales 2016 年 10 月 29 日
I've looked at the results after tweaking the initial conditions ([1,0,0]), but the graph always slopes downwards, whereas I'm expecting a downwards slope for only one graph, and upwards for the rest until they stabilize.

サインインしてコメントする。

カテゴリ

質問済み:

2016 年 10 月 28 日

コメント済み:

2016 年 10 月 29 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by