How do I write a delayed differential equation ?
조회 수: 9 (최근 30일)
이전 댓글 표시
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
Torsten
2017년 6월 2일
Given t, can't you just evaluate yc(t-L) (e.g. by interpolation) ? Or is yc not explicitly given ?
Best wishes
Torsten.
답변 (1개)
Shishir Reddy
2025년 5월 28일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!