Solving simple integro-differential equation using dsolve in Matlab
11 ビュー (過去 30 日間)
古いコメントを表示
I have following integro-differential equation:
I tried to solve it using symbolic math toolbox in Matlab:
syms x(t)
Dx = diff(x,t)
cond = x(0)==1
eqn = Dx + 2*x + 2*int(x) == 0
x(t) = dsolve(eqn, cond)
dsolve gives:
x(t) =
exp(1 - (2*t + 2)^2/4)
Matlab solution is wrong.
Solving equation by hand using Laplace transform I get:
Why Matlab gives the wrong symbolic solution?
Thank you.
0 件のコメント
回答 (1 件)
Torsten
2024 年 3 月 18 日
編集済み: Torsten
2024 年 3 月 18 日
If you insert the line
simplify(diff(x,t)+2*x+2*x*t)
you will see that this expression turns out to be equal to 0. So MATLAB interprets x(t) as constant over [0 t] in the integration.
I'd say that "dsolve" is not suited to solve integro-differential equations or - since you don't get an error message - it's a bug.
1 件のコメント
Paul
2024 年 3 月 19 日
編集済み: Paul
2024 年 3 月 20 日
Not a solution to the problem, but worth pointing out that the code does not properly reflect the actual equation in the question.
syms x(t)
Dx = diff(x,t);
cond = x(0)==1;
eqn = Dx + 2*x + 2*int(x) == 0
Here, int(x) is an anti-derivative of x(t), which is not the same as the integral in the problem statement.
Consequently, further operations on eqn may not yield the expected result. For example, taking the Laplace transform does not apply the expected "integral rule" to the third term.
laplace(eqn)
The equation should be entered as
syms tau
eqn = Dx + 2*x + 2*int(x(tau),tau,0,t) == 0
The output from dsolve still not neccessarily helpful
sol(t) = dsolve(eqn,cond)
But now laplace() works and we can solve the problem that way
Leqn = laplace(eqn)
syms s
L(s) = rhs(isolate(Leqn,laplace(x,t,s)))
x(t) = ilaplace(subs(L(s),x(0),1))
参考
カテゴリ
Help Center および File Exchange で Equation Solving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!