- Initial conditions.
- Boundary conditions.
- The diffusion coefficient, denoted as "D", plays a crucial role in governing the speed at which spatial spreading occurs.
- The growth rate parameter, represented by "r", determines the rate of population growth.
Pdepe function giving a different plot from what I expect
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi everyone,
I tried to solve a Fisher Kolmogorov pde equation using pdepe. Matlab does not give any sign of error still I don't get what I was supposed to. I include my code:
x=linspace(0,1);
t=linspace(0,8*365);
m = 0;
u= pdepe(m,@heatcyl,@heatic,@heatbc,x,t);
surf(x,t,u)
xlabel('x')
ylabel('t')
zlabel('u(x,t)')
view([150 25])
figure
plot(t,u(100,:));
function [c,f,s]=heatcyl(x,t,u,dudx)
c = 1;
f = dudx;
s = 0.01*(1-u).*u;
end
%initial condition
function u0 = heatic(x)
u0 = 0.3*sech(0.3*x);
end
%boundary conditions
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = 0;
ql = 1;
pr = 0;
qr = 1;
end
I would expect, if I plot the solution at a certain time t , to get the classical plot :
Boundary condition are no flux conditions and the initial condition is the one indicated in the code
I also include the equation I start from:
Thanks in advance to anyone giving advice.
0 Kommentare
Antworten (1)
SAI SRUJAN
am 10 Okt. 2023
Hi Francesca Punzi,
I understand that you facing diffoculty in producing the desired output of Fisher Kolmogorov pde equation.
The following is the Fisher Kolmogorov partial differential equation.
You can follow the below given example to resolve the issue.
x=linspace(0,20);
t=linspace(0,1);
m=0;
u= pdepe(m,@heatcyl,@heatic,@heatbc,x,t);
plot(t,u(2,:),'--');
function [c,f,s]=heatcyl(x,t,u,dudx)
D=0.1;
r=0.5;
c = 1;
f = dudx*D;
s = r*u*(1-u);
end
%initial condition
function u0 = heatic(x)
u0 = sech(x);
end
%boundary conditions
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = 0;
ql = 1;
pr = 0;
qr = 1;
end
In order to effectively accomplish the desired outcome, the process is significantly influenced by the following variables and conditions:
You can refer to the below documentation to understand more about "pdepe" function in MATLAB.
0 Kommentare
Siehe auch
Kategorien
Mehr zu PDE Solvers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!