How to solve a partial derivative equation in MATLAB?

7 views (last 30 days)
Hello, orgininally I solved this set of differential equations using Euler's method:
Equations.JPG
they were solved with this:
for i=1:1:500000
t(i+1)=t(i)+dt;
u(i+1) = u(i)+ dt*((1/e)*((k*u(i)*(u(i)-a)*(1-u(i)))-v(i)));
v(i+1) = v(i)+ dt*(u(i)-v(i));
end
Now I have a similar set of equations as shown below:
equations.JPG
Can anyone explain how I might go about adjusting my code to solve for this partial derivative in the new equations? Thank you so much!
Here is the full source code:
%Clear command window and workspace
clear
close all
clc
% Fitzhugh-Nagoma model parameters
e=0.03; k=3; a=0.05;
i = 0.001;
figure(1);
hold on
u=zeros(100000,1);
v=zeros(100000,1);
t=zeros(100000,1);
% Initial conditions:
u(1)=0.6;
v(1)=0.0;
t(1)=0;
dt=0.001;
%==========================================================================
% Forvard Euler Method, for soluing the ODE
%==========================================================================
for i=1:1:500000
t(i+1)=t(i)+dt;
u(i+1) = u(i)+ dt*((1/e)*((k*u(i)*(u(i)-a)*(1-u(i)))-v(i)));
v(i+1) = v(i)+ dt*(u(i)-v(i));
end
% Getting the plot
figure(1);
plot(t,u)
legend('u','Trajectory')
title('Time Series Plot')
xlabel('Time')
ylabel('u')
xlim([0 5])

Answers (1)

Torsten
Torsten on 26 Nov 2018
Use "pdepe".
Best wishes
Torsten.

Community Treasure Hunt

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

Start Hunting!