dsolve and heaviside (unit step response)
Mostrar comentarios más antiguos
Hi, I'm trying to understand the behaviour of dsolve and heaviside for solving a simple ODE.
syms y(t)
Y = dsolve(diff(y)+y == 1, y(0) == 0)
ezplot(Y,[0,5])
Gives the desired response of a first order LTI ODE to a step, i.e. Y = 1 - exp(-t) (not too worried about negative time). However,
sympref('HeavisideAtOrigin', 1)
Y = dsolve(diff(y)+y == heaviside(t), y(0) == 0)
ezplot(Y,[0,5])
Produces Y = sign(t)/2 - exp(-t)/2 + 1/2 so the value at Y(0) is 0.5, rather than starting from Y(0)=0.
Given the same initial value and forcing function 1 for t>=0, they should produce the same result? Obviously, the first result is the one I was expecting.
Respuesta aceptada
Más respuestas (1)
Torsten
el 21 de Feb. de 2018
Why Y(0)=0.5 ?
Y(0) = sign(0)/2-exp(-0)/2+1/2 = 0-1/2+1/2 = 0.
Best wishes
Torsten.
1 comentario
Martin Brown
el 21 de Feb. de 2018
Editada: Martin Brown
el 21 de Feb. de 2018
Categorías
Más información sobre Special Values en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!