Direct Quadrature for Delay Renewal Equation

20 ビュー (過去 30 日間)
Muhammad
Muhammad 2024 年 10 月 23 日
コメント済み: Muhammad 2024 年 10 月 23 日
I'm trying to solve a delay renewal equation with a quadratic nonlinearity using direct quadrature in MATLAB. Here's the code I'm using, but I'm not getting the expected results. Can someone help me identify any mistakes or suggest improvements?
gamma = 5;
tau = 3;
t_min = 0;
t_max = 20;
dt = 0.1;
t_vals = t_min:dt:t_max;
phi = @(t) 0.5 * ones(size(t));
x_vals = zeros(size(t_vals));
x_vals(1) = phi(0);
for i = 2:length(t_vals)
t = t_vals(i);
integral_term = integral(@(theta) delayed(t + theta, t_vals, x_vals, phi) ...
.* (1 - delayed(t + theta, t_vals, x_vals, phi)), -tau, -1, ...
'RelTol', 1e-10, 'AbsTol', 1e-10);
x_vals(i) = (gamma / 2) * integral_term;
end
figure;
plot(t_vals, x_vals, 'LineWidth', 2);
xlabel('Time');
ylabel('x(t)');
title('Solution of the Delay Renewal Equation (Direct Quadrature)');
function val = delayed(t, t_vals, x_vals, phi)
if t < 0
val = phi(t);
else
val = interp1(t_vals, x_vals, t, 'linear', 'extrap');
end
end
Thanks in advance
  2 件のコメント
Sahas
Sahas 2024 年 10 月 23 日
Hi,
Can you share the expected results? It will help me assist you better.
Muhammad
Muhammad 2024 年 10 月 23 日
like here for different gamma values, different results but for my code it is not possible
gamma = 0.5;
tau = 3;
t_min = 0;
t_max = 20;
dt = 0.1;
t_vals = t_min:dt:t_max;
phi = @(t) 0.5 * ones(size(t));
x_vals = zeros(size(t_vals));
x_vals(1) = phi(0);
for i = 2:length(t_vals)
t = t_vals(i);
integral_term = integral(@(theta) delayed(t + theta, t_vals, x_vals, phi) ...
.* (1 - delayed(t + theta, t_vals, x_vals, phi)), -tau, -1, ...
'RelTol', 1e-10, 'AbsTol', 1e-10);
x_vals(i) = (gamma / 2) * integral_term;
end
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
Warning: Inf or NaN value encountered.
figure;
plot(t_vals, x_vals, 'LineWidth', 2);
xlabel('Time');
ylabel('x(t)');
title('Solution of the Delay Renewal Equation (Direct Quadrature)');
function val = delayed(t, t_vals, x_vals, phi)
if t < 0
val = phi(t);
else
val = interp1(t_vals, x_vals, t, 'linear', 'extrap');
end
end

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGamma Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by