deq(t) =
Solution of ODE with Symbolic Math Toolbox.
Show older comments
Hello,
I want to solve the ordinary differential equation

with
,
,
. The function and
should be a unity step. In other words: it is the step response of a first order lag element. I am using the Symbolic Math Toolbox.
First I define the variables including the relevant assumptions.
syms("t", "positive")
syms("T_1", "k_p", "positive")
syms("u(t)", "y(t)")
The I establish the differential equation
deq = T_1 * diff(y, t) + y == k_p * u
and replace
with the unist step function.
deq = subs(deq, u, heaviside(t))
The solution
y_sol_t = dsolve(deq, y(0) == 0)
y_sol_t = simplify(y_sol_t)
is not very clear for students. It is hard to see that
for
.
If I use the Laplace Transform instead I get: the following result.
Laplace Transform of the above differential equation.
syms("s")
aeq = laplace(deq, t, s)
syms("y_LT")
Replacing laplace(y(t), t, s) and the initial condition
aeq = subs(aeq, [laplace(y(t), t, s) y(0)], [y_LT, 0])
Solve the algbraic equation vor y_LT
y_LT = solve(aeq, y_LT)
Inverse Laplace Transform
y_sol_LT = ilaplace(y_LT, s, t)
which is valid only for
, but can be extended to the general solt ion by multiplying it with ethe unit step.
y_sol_LT = y_sol_LT * heaviside(t)
How can I obtain this solution from the result calculated using dsolve?
Michael
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





