Effacer les filtres
Effacer les filtres

How to solve coupled partial differential equation with an integral term?

2 vues (au cours des 30 derniers jours)
MANOJ KUMAR
MANOJ KUMAR le 15 Nov 2020
I want to solve the below given PDE system in MATLAB,
I have written a code but I am not able to solve integro differential equation in this system.
%% discretizing a
dx=0.25;
x=0:dx:20;
m=length(x);
% discretizing time
dt=0.01;
%Tp=(10)^(-1);
% Tf=input('enter the max time');
Tf=20;
t=0:dt:Tf;
n=length(t);
%% parameter values
a3=0; a4=1000; rho = 0.2;
c=1; alpha = 0.40; mu = 0.30; k=0.5; lambda=50;
%% size of the matrix
A=zeros(m,n);
B=zeros(m,n);
S=zeros(1,n);
R=zeros(1,n);
sum=zeros(1,n);
%% initial data
S(1) = a4; % S_s
R(1) = a3; % R_s
%% defining functions
for i=1:m
a1(i) = 0; %l_s(a)
a2(i) = 0; %i_s(a)
p(i) = 1700*(1-exp(-x(i))); %p(a)
% p(i) = i; %p(a)
delta1(i) = 0.01; % delta_l(a)
delta2(i) = 0.4; % delta_i(a)
end
%% initial conditions
for i=1:m
A(i,1) = a1(i);
B(i,1) = a2(i);
sum(1)=trapz(p(i).* B(i,1))*dx;
end
% %trapz(p(i)* B(:,i))*dx%
%% discretizing age and time derivative
for j=1:n-1
for i=2:m-1
A(i,j+1)=A(i,j)+dt*(-(A(i+1,j) - A(i-1,j))/(2*dx) - alpha*A(i,j)-delta1(i)*A(i,j));
B(i,j+1)=B(i,j)+dt*(-(B(i+1,j) - B(i-1,j))/(2*dx) +alpha*A(i,j)-delta2(i)*B(i,j));
sum(j+1)=trapz(p(i).* B(i,j))*dx;
S(j+1) = S(j) + dt*(lambda - k*R(j).*S(j) - mu*S(j));
R(j+1) = R(j)+ dt*sum(j+1) - dt*c*R(j);
end
% boundary conditions
A(1,j+1)= rho*k*R(j)*S(j);
B(1,j+1)= (1-rho)*k*R(j)*S(j);
end
plot(t,S,'b-', t,R,'r-');
I have plotted the solution but the plot of R(t) is not correct, I feel that I am not able to solve integro differential correctly. Please help me to solve integro differential equation by some method.
  4 commentaires
Bill Greene
Bill Greene le 16 Nov 2020
I am confused by your boundary condition on l. You show
but it looks like in your code
Please clarify this.
MANOJ KUMAR
MANOJ KUMAR le 16 Nov 2020
Sorry again this was a typo, I corrected it.

Connectez-vous pour commenter.

Réponses (1)

Hewa selman
Hewa selman le 23 Déc 2021
hello it does not work. could you please write the last version of your code again
with regards

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!

Translated by