# Help solving linear ordinary differential equation that involves matrix

38 ビュー (過去 30 日間)
Emma 2024 年 7 月 16 日 16:19

I need to find the general solution to a linear ordinary differential equation that involves a matrix. The problem is in the form x'(t) = [ matrix] x(t). When I try to solve, it gives me a solution for x and y but neither one is correct. It needs to be in the form c1(e^t)[matrix] + c2(e^t)[matrix]. thank you.
##### 1 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
Torsten 2024 年 7 月 16 日 18:16
Please show us your code.
What is y ?

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

### 回答 (1 件)

John D'Errico 2024 年 7 月 16 日 21:34

I would postulate that in fact, it DOES give the correct solution, at least to the problem you posed, but that it is not in the form you may want to see. This is a huge difference. Two expressions can be mathematically identical, yet appear different. That does not make one incorrect. Merely unexpected.
If you want help however, you need to show what you did, as your question is not clear. What for example, is y, since you defined the problem in terms of x, which as you wrote it, must be a vector of unknowns.
I conjecture you are doing something (at least equivalent) to this:
syms x1(t) x2(t)
x = [x1;x2];
syms a
A = [1 2;3 a];
xsol = dsolve(diff(x,t) == A*x,x1(0) == 1,x2(0) == 0)
xsol = struct with fields:
x2: (3*exp(0.5000*t*(a + (a^2 - 2*a + 25)^(1/2) + 1)))/(a^2 - 2*a + 25)^0.5000 - (3*exp(0.5000*t*(a - (a^2 - 2*a + 25)^(1/2) + 1)))/(a^2 - 2*a + 25)^0.5000 x1: (3*exp(0.5000*t*(a + (a^2 - 2*a + 25)^(1/2) + 1))*(0.1667*(a^2 - 2*a + 25)^(1/2) - 0.1667*a + 0.1667))/(a^2 - 2*a + 25)^0.5000 + (3*exp(0.5000*t*(a - (a^2 - 2*a + 25)^(...
Now, the fact is, you probably learned in a class somewhere, that we can write the solution in terms of a matrix exponential which is the general form you showed in your question. And in fact, after some algebra, it would reduce to the same thing as what dsolve produced, but as I said, it looks different from what dsolve returns. That does not make it incorrect however, merely unexpected. The solution is still entirely valid. We could even, with some minor algebra of our own, convert the result that dsolve returned into a matrix exponential form. And, yes, the matrix exponential you want to see probably seems a cleaner way to represent the solution. Such is life.

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

### カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

R2024a

### Community Treasure Hunt

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

Start Hunting!

Translated by