How do I write a delayed differential equation ?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Torsten
le 2 Juin 2017
Given t, can't you just evaluate yc(t-L) (e.g. by interpolation) ? Or is yc not explicitly given ?
Best wishes
Torsten.
Réponses (1)
Shishir Reddy
le 28 Mai 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 commentaires
Voir également
Catégories
En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!