How to solve a partial derivative equation in MATLAB?

1 回表示 (過去 30 日間)
Westin Messer
Westin Messer 2018 年 11 月 24 日
回答済み: Torsten 2018 年 11 月 26 日
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])

回答 (1 件)

Torsten
Torsten 2018 年 11 月 26 日
Use "pdepe".
Best wishes
Torsten.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by