How do I write a delayed differential equation ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
I am currently trying to implement the following delayed differential equation:
y_dot(t)=K*yc(t-L)-(1/T)*y(t)
with yc the input of the associated transfer function and y the output.
My problem is how do I write this equation using a solver like ode ?
I saw the solver dde but it seems to be useful if my delay is in y but here it's in the input yc..
I also tried to rewrite like y_dot(t+L)=K*yc(t)-(1/T)*y(t+L) but I have the same issue writing it in ODE..
Thanks in advance
2 comentarios
Torsten
el 2 de Jun. de 2017
Given t, can't you just evaluate yc(t-L) (e.g. by interpolation) ? Or is yc not explicitly given ?
Best wishes
Torsten.
Respuestas (1)
Shishir Reddy
el 28 de Mayo de 2025
Hi Vincent,
To solve a delayed differential equation (DDE) in MATLAB where the delay is in the input signal yc(t−L) rather than in the state y(t−L) you can still use MATLAB's ‘dde23’ solver. However, the key point is that ‘dde23’ allows delays in any function used in the equation, not just the state variable.
Kindly refer the to the following steps to understand how this can be implemented in MATLAB using ‘dde23’.
1. Define the parameters and DDE as a function –
L = 1; % example delay value
yc = @(t) sin(t); % example input
K = 2; % gain
T = 5; % time constant
ddeFunc = @(t, y, Z) K * yc(t - L) - (1/T) * y;
2. Set history and time span.
y0 = 0; % initial condition
history = @(t) y0;
tspan = [0, 20];
3. Solve using ‘dde23’ and plot
sol = dde23(ddeFunc, L, history, tspan);
plot(sol.x, sol.y)
xlabel('Time t')
ylabel('Output y(t)')
title('Response of the DDE with delayed input').
For more information regarding the ‘dde23’ solver, kindly refer the following documentation - https://www.mathworks.com/help/matlab/ref/dde23.html
I hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Mathematics and Optimization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!