I wish to perform a symbolic integration over time; the code is given below.
syms x1 u1 t
x1 = symfun(sym('x1(t)'), [t]);
x1dot = p1 + p4*p8 - p13*x1;
int(x1dot,t)
The answer should be:
e^(-p13*t)*x1(0)+(p1 + p4*p8)/(-p13)*[1-e^(-p13*t)]
what I get is:
Warning: Explicit integral could not be found.
ans(t) =
int(p1 - p13*x1(t) + p4*p8*u1(t), t)
It seems to me that it does not recognize that x1dot
is the derivative of x1
. How can I solve this issue?
What you are trying to do is not strictly speaking integration, i.e. from a known function
f(t)
deduce a functionF(t)
such that the derivative ofF
isf
. The original function is not really known, since it depends on itself (no matter how trivial the relationship might seem to a human, you need to inverse it).It is rather solving a differential equation, for which
dsolve
is probably the way to go. MATLAB has no way to guess thatx1dot
is the derivative ofx1
. I guess you could declarex1dot=diff(x1)
but why not usediff(x1)
directly where needed ?