ddesd solver for discrete points

3 visualizaciones (últimos 30 días)
RUPAL AGGRAWAL
RUPAL AGGRAWAL el 10 de Feb. de 2024
Respondida: RUPAL AGGRAWAL el 10 de Feb. de 2024
How to solve delay differential equation using ddesd solver at discrete points. For example
Solve y'(x) = y(x - sin(x)): y(0) = 0 and y(x)= 1 for x <0.
Solve the above equaton using ddesd solver at x = 0, 1, 2, 7, 8, 9, 11, 12.
This is an example. you can provide a generalized syntax also.

Respuesta aceptada

Steven Lord
Steven Lord el 10 de Feb. de 2024
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
One hint from the documentation page for the ddesd solver:
ddesd returns the solution as a structure sol. Use the auxiliary function deval and the output sol to evaluate the solution at specific points tint in the interval tspan = [t0,tf].
yint = deval(sol,tint)

Más respuestas (1)

RUPAL AGGRAWAL
RUPAL AGGRAWAL el 10 de Feb. de 2024
Hey! Thank you so much for your answer, Following are the codes.
%Main file to run
clear all;
clc;
tf = 5;
t = linspace(0,tf,10);
hist = 1;
sol = ddesd(@ddefunc, @delays, hist, t)
tint = [0.0312 0.0938 0.1562 0.2188 0.2812 0.3438 0.4062 0.4688 0.5312 0.5938 0.6562 0.7188 0.7812 0.8438 0.9062 0.9688];
yint = deval(sol, tint)
%Sepayat filefor ddefunc
function yp = ddefunc(t, y, yL)
yp = y - (y*(yL));
end
%Separate file foe delays
function d = delays(t, x)
d = sin(t);
end
COMMENT: y is 1. I am not sure if the codes are codes are correct neither i know the answer

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by