Hi Sofia,
I understand that you are trying to reproduce periodic plots for (P) and (T) using a system of delay differential equations (DDEs) solved by MATLAB's dde23 function but are not observing the expected behavior. To address this, ensure the accuracy of your model parameters, initial conditions, and history function. Additionally, adjusting the numerical solver's settings may help capture the system's dynamics more accurately. Here's a concise approach to potentially resolve the issue:
- Verify Model Parameters and Functions: Double-check that all parameters and the mathematical model accurately reflect the intended system.
- Adjust Solver Settings: Use odeset to adjust solver tolerances, which might improve the accuracy of the solution, revealing the expected periodic behavior.
- Ensure Sufficient Simulation Time and Sampling: Make sure your tspan and the number of points sampled (e.g., in linspace) are sufficient to capture the periodic dynamics.
- Review Initial and History Conditions: Confirm that the history function Xhist accurately represents the system's state for (t < 0).
options = odeset('RelTol',1e-6, 'AbsTol',1e-8);
sol = dde23(@ddefunc, lags, @Xhist, tspan, options);
Incorporating these considerations, here's how you could adjust your MATLAB code:
function mainfunc()
% [Your existing parameters here]
% Time-delays
taum = 8.09;
taue = 5;
lags = [taum, taue, (taue + taum)]; % constant time-delays
% Solver options for improved accuracy
options = odeset('RelTol',1e-6, 'AbsTol',1e-8);
% Implementation of the dde23 solver
tspan = [0, 30];
sol = dde23(@ddefunc, lags, @Xhist, tspan, options);
% [Continue with your plotting code]
end
This approach, especially the solver settings adjustment, will help in capturing the expected periodic behavior of your system.
Hope this helps.
Regards,
Nipun