Solving simple integro-differential equation using dsolve in Matlab

12 次查看(过去 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.

回答(1 个)

Torsten
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
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
eqn(t) = 
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)
ans = 
The equation should be entered as
syms tau
eqn = Dx + 2*x + 2*int(x(tau),tau,0,t) == 0
eqn(t) = 
The output from dsolve still not neccessarily helpful
sol(t) = dsolve(eqn,cond)
sol(t) = 
But now laplace() works and we can solve the problem that way
Leqn = laplace(eqn)
Leqn = 
syms s
L(s) = rhs(isolate(Leqn,laplace(x,t,s)))
L(s) = 
x(t) = ilaplace(subs(L(s),x(0),1))
x(t) = 

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by