Is the Result from dsolve() Justified for a heaviside() Input?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
This question is a follow up to this one that I feel warrants a separate discussion. The problem is ...
Solve this differential equation
syms y(t) u(t)
ode = diff(y(t),t,3) + 6*diff(y(t),t,2) + 11*diff(y(t),t) + 6*y(t) == diff(u(t),t,2) + 2*diff(u(t),t) + 3*u(t)
with u(t) = heaviside(t) and initial condtions zero for t = -1. Using dsolve we get
ydsol(t) = simplify(dsolve(subs(ode,u(t),heaviside(t)),[y(-1)==0, subs(diff(y(t),t),t,-1)==0 subs(diff(y(t),t,2),t,-1)==0]))
If ydsol(t) is the solution, it should satisfy the IC's
subs([ydsol(t), diff(ydsol(t),t) diff(ydsol(t),t,2)],t,-1)
which it does. But it should also satisfy the differential equation
simplify(subs(lhs(ode),y(t),ydsol(t))) == simplify(subs(rhs(ode),u(t),heaviside(t)))
which it does not.
The result ydsol(t) doesn't look correct. Is this user error on my part?
The correct answer can be obtained by first finding the impulse response
yimp(t) = simplify(dsolve(subs(ode,u(t),dirac(t)),[y(-1)==0, subs(diff(y(t),t),t,-1)==0 subs(diff(y(t),t,2),t,-1)==0]))
and then integrating the impulse response to get the step response
syms tau
ystep(t) = simplify(int(yimp(tau),tau,0,t)*heaviside(t))
Verify the initial conditions
subs([ystep(t), diff(ystep(t),t) diff(ystep(t),t,2)],t,-1)
And verify the solution satisfies the differential equation
simplify(subs(lhs(ode),y(t),ystep(t))) == simplify(subs(rhs(ode),u(t),heaviside(t)))
ystep(t) is clearly (IMO) correct.
We can also obtain the solution via the Laplace transform, pretty much by inspection
syms s
ylap(t) = ilaplace((s^2 + 2*s + 3)/(s^3 + 6*s^2 + 11*s + 6)/s)*heaviside(t)
which is identical to ystep(t).
The appoximate solution from the Control System Toolbox is
tsim = 0:1e-3:10;
ycst = step(tf([1 2 3],[1 6 11 6]),tsim);
FWIW, here's how the solutions compare graphically
fplot([ydsol(t) ystep(t)],[-1 10])
hold on
plot(tsim(1:100:end),ycst(1:100:end),'o')
legend('ydsol(t)','ystep(t)','ycst(t)')
Can anyone explain how the result ydsol(t) might be justified?
Risposte (0)
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!